@atomicfinance/types 2.5.1 → 3.0.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.
Files changed (51) hide show
  1. package/.turbo/turbo-build.log +1 -2
  2. package/.turbo/turbo-lint.log +1 -0
  3. package/.turbo/turbo-lint:fix.log +45 -0
  4. package/.turbo/turbo-test.log +1 -3
  5. package/CHANGELOG.md +6 -0
  6. package/dist/address.d.ts +10 -0
  7. package/dist/address.js +11 -0
  8. package/dist/address.js.map +1 -0
  9. package/dist/bitcoin.d.ts +66 -0
  10. package/dist/bitcoin.js +16 -0
  11. package/dist/bitcoin.js.map +1 -0
  12. package/dist/block.d.ts +10 -0
  13. package/dist/{financewallet.js → block.js} +1 -1
  14. package/dist/block.js.map +1 -0
  15. package/dist/chain.d.ts +107 -0
  16. package/dist/chain.js +3 -0
  17. package/dist/chain.js.map +1 -0
  18. package/dist/fees.d.ts +17 -0
  19. package/dist/fees.js +3 -0
  20. package/dist/fees.js.map +1 -0
  21. package/dist/index.d.ts +13 -9
  22. package/dist/index.js +23 -2
  23. package/dist/index.js.map +1 -1
  24. package/dist/jsonrpc.d.ts +72 -0
  25. package/dist/jsonrpc.js +3 -0
  26. package/dist/jsonrpc.js.map +1 -0
  27. package/dist/models/Input.d.ts +8 -8
  28. package/dist/models/Input.js +7 -7
  29. package/dist/models/Input.js.map +1 -1
  30. package/dist/network.d.ts +5 -0
  31. package/dist/network.js +3 -0
  32. package/dist/network.js.map +1 -0
  33. package/dist/transaction.d.ts +17 -0
  34. package/dist/transaction.js +10 -0
  35. package/dist/transaction.js.map +1 -0
  36. package/dist/wallet.d.ts +78 -0
  37. package/lib/address.ts +13 -0
  38. package/lib/bitcoin.ts +72 -0
  39. package/lib/block.ts +18 -0
  40. package/lib/chain.ts +126 -0
  41. package/lib/fees.ts +21 -0
  42. package/lib/index.ts +31 -9
  43. package/lib/jsonrpc.ts +81 -0
  44. package/lib/models/Input.ts +8 -9
  45. package/lib/network.ts +5 -0
  46. package/lib/transaction.ts +28 -0
  47. package/lib/wallet.ts +109 -0
  48. package/package.json +3 -5
  49. package/dist/financewallet.d.ts +0 -11
  50. package/dist/financewallet.js.map +0 -1
  51. package/lib/financewallet.ts +0 -31
@@ -1,2 +1 @@
1
- @atomicfinance/types:build: cache hit, replaying output 17f9a71a0dcdf1db
2
- @atomicfinance/types:build: $ ../../node_modules/.bin/tsc --project tsconfig.json
1
+ @atomicfinance/types:build: cache hit, replaying output ca44072ac84d3b52
@@ -0,0 +1 @@
1
+ @atomicfinance/types:lint: cache hit, replaying output 8ec25e5b0a472eb9
@@ -0,0 +1,45 @@
1
+ @atomicfinance/types:lint:fix: cache hit, replaying output 81d44a9a9a4a7e29
2
+ @atomicfinance/types:lint:fix: 
3
+ @atomicfinance/types:lint:fix: /Users/steven/src/atomicfinance/chainify-finance/packages/types/lib/block.ts
4
+ @atomicfinance/types:lint:fix:  1:42 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
5
+ @atomicfinance/types:lint:fix: 
6
+ @atomicfinance/types:lint:fix: /Users/steven/src/atomicfinance/chainify-finance/packages/types/lib/dlc.ts
7
+ @atomicfinance/types:lint:fix:  288:11 warning 'ISig' is defined but never used @typescript-eslint/no-unused-vars
8
+ @atomicfinance/types:lint:fix:  303:11 warning 'FindOutcomeResponse' is defined but never used @typescript-eslint/no-unused-vars
9
+ @atomicfinance/types:lint:fix: 
10
+ @atomicfinance/types:lint:fix: /Users/steven/src/atomicfinance/chainify-finance/packages/types/lib/index.ts
11
+ @atomicfinance/types:lint:fix:  23:41 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
12
+ @atomicfinance/types:lint:fix:  23:53 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
13
+ @atomicfinance/types:lint:fix:  24:62 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
14
+ @atomicfinance/types:lint:fix: 
15
+ @atomicfinance/types:lint:fix: /Users/steven/src/atomicfinance/chainify-finance/packages/types/lib/models/Amount.ts
16
+ @atomicfinance/types:lint:fix:  15:3 warning Missing return type on function @typescript-eslint/explicit-module-boundary-types
17
+ @atomicfinance/types:lint:fix:  20:3 warning Missing return type on function @typescript-eslint/explicit-module-boundary-types
18
+ @atomicfinance/types:lint:fix:  25:3 warning Missing return type on function @typescript-eslint/explicit-module-boundary-types
19
+ @atomicfinance/types:lint:fix:  30:3 warning Missing return type on function @typescript-eslint/explicit-module-boundary-types
20
+ @atomicfinance/types:lint:fix:  36:3 warning Missing return type on function @typescript-eslint/explicit-module-boundary-types
21
+ @atomicfinance/types:lint:fix:  42:3 warning Missing return type on function @typescript-eslint/explicit-module-boundary-types
22
+ @atomicfinance/types:lint:fix:  47:3 warning Missing return type on function @typescript-eslint/explicit-module-boundary-types
23
+ @atomicfinance/types:lint:fix:  53:3 warning Missing return type on function @typescript-eslint/explicit-module-boundary-types
24
+ @atomicfinance/types:lint:fix:  72:31 warning Argument 'value' should be typed with a non-any type @typescript-eslint/explicit-module-boundary-types
25
+ @atomicfinance/types:lint:fix:  72:38 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
26
+ @atomicfinance/types:lint:fix:  72:44 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
27
+ @atomicfinance/types:lint:fix: 
28
+ @atomicfinance/types:lint:fix: /Users/steven/src/atomicfinance/chainify-finance/packages/types/lib/models/Outcome.ts
29
+ @atomicfinance/types:lint:fix:  27:31 warning Argument 'value' should be typed with a non-any type @typescript-eslint/explicit-module-boundary-types
30
+ @atomicfinance/types:lint:fix:  27:38 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
31
+ @atomicfinance/types:lint:fix:  27:44 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
32
+ @atomicfinance/types:lint:fix: 
33
+ @atomicfinance/types:lint:fix: /Users/steven/src/atomicfinance/chainify-finance/packages/types/lib/models/Utxo.ts
34
+ @atomicfinance/types:lint:fix:  54:31 warning Argument 'value' should be typed with a non-any type @typescript-eslint/explicit-module-boundary-types
35
+ @atomicfinance/types:lint:fix:  54:38 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
36
+ @atomicfinance/types:lint:fix:  54:44 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
37
+ @atomicfinance/types:lint:fix: 
38
+ @atomicfinance/types:lint:fix: /Users/steven/src/atomicfinance/chainify-finance/packages/types/lib/transaction.ts
39
+ @atomicfinance/types:lint:fix:  1:34 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
40
+ @atomicfinance/types:lint:fix: 
41
+ @atomicfinance/types:lint:fix: /Users/steven/src/atomicfinance/chainify-finance/packages/types/lib/wallet.ts
42
+ @atomicfinance/types:lint:fix:  74:34 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
43
+ @atomicfinance/types:lint:fix: 
44
+ @atomicfinance/types:lint:fix: ✖ 25 problems (0 errors, 25 warnings)
45
+ @atomicfinance/types:lint:fix: 
@@ -1,3 +1 @@
1
- @atomicfinance/types:test: cache hit, replaying output ee657065d480a779
2
- @atomicfinance/types:test: $ yarn run build
3
- @atomicfinance/types:test: $ ../../node_modules/.bin/tsc --project tsconfig.json
1
+ @atomicfinance/types:test: cache hit, replaying output de5924699b821421
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atomicfinance/types
2
2
 
3
+ ## 3.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - a06082e: Create unified standalone `bitcoin-abstraction-layer` package
8
+
3
9
  ## 2.5.1
4
10
 
5
11
  ### Patch Changes
@@ -0,0 +1,10 @@
1
+ export declare class Address {
2
+ address: string;
3
+ derivationPath?: string;
4
+ publicKey?: string;
5
+ constructor(fields?: {
6
+ address: string;
7
+ derivationPath?: string;
8
+ publicKey?: string;
9
+ });
10
+ }
@@ -0,0 +1,11 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.js","sourceRoot":"","sources":["../lib/address.ts"],"names":[],"mappings":";;;AAAA,MAAa,OAAO;IAKlB,YAAY,MAIX;QACC,IAAI,MAAM;YAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;CACF;AAZD,0BAYC"}
@@ -0,0 +1,66 @@
1
+ /// <reference types="node" />
2
+ export interface OutputTarget {
3
+ address?: string;
4
+ script?: Buffer;
5
+ value: number;
6
+ }
7
+ export interface ScriptPubKey {
8
+ asm: string;
9
+ hex: string;
10
+ reqSigs: number;
11
+ type: string;
12
+ addresses: string[];
13
+ }
14
+ export interface Output {
15
+ value: number;
16
+ n: number;
17
+ scriptPubKey: ScriptPubKey;
18
+ }
19
+ export interface Input {
20
+ txid: string;
21
+ vout: number;
22
+ scriptSig: {
23
+ asm: string;
24
+ hex: string;
25
+ };
26
+ txinwitness: string[];
27
+ sequence: number;
28
+ coinbase?: string;
29
+ }
30
+ export interface Transaction {
31
+ txid: string;
32
+ hash: string;
33
+ version: number;
34
+ locktime: number;
35
+ size: number;
36
+ vsize: number;
37
+ weight: number;
38
+ vin: Input[];
39
+ vout: Output[];
40
+ confirmations?: number;
41
+ hex: string;
42
+ }
43
+ export interface UTXO {
44
+ txid: string;
45
+ vout: number;
46
+ value: number;
47
+ address: string;
48
+ derivationPath?: string;
49
+ }
50
+ export declare enum AddressType {
51
+ LEGACY = "legacy",
52
+ P2SH_SEGWIT = "p2sh-segwit",
53
+ BECH32 = "bech32"
54
+ }
55
+ export declare enum SwapMode {
56
+ P2SH = "p2sh",
57
+ P2SH_SEGWIT = "p2shSegwit",
58
+ P2WSH = "p2wsh"
59
+ }
60
+ export declare type AddressTxCounts = {
61
+ [index: string]: number;
62
+ };
63
+ export interface PsbtInputTarget {
64
+ index: number;
65
+ derivationPath: string;
66
+ }
@@ -0,0 +1,16 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bitcoin.js","sourceRoot":"","sources":["../lib/bitcoin.ts"],"names":[],"mappings":";;;AAsDA,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,0CAA2B,CAAA;IAC3B,gCAAiB,CAAA;AACnB,CAAC,EAJW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAItB;AAED,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,sCAA0B,CAAA;IAC1B,2BAAe,CAAA;AACjB,CAAC,EAJW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAInB"}
@@ -0,0 +1,10 @@
1
+ export interface Block<TransactionType = any> {
2
+ number: number;
3
+ hash: string;
4
+ timestamp: number;
5
+ size: number;
6
+ parentHash: string;
7
+ difficulty?: number;
8
+ nonce?: number;
9
+ transactions?: TransactionType[];
10
+ }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=financewallet.js.map
3
+ //# sourceMappingURL=block.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block.js","sourceRoot":"","sources":["../lib/block.ts"],"names":[],"mappings":""}
@@ -0,0 +1,107 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { Address } from './address';
3
+ import { Block } from './block';
4
+ import { Transaction } from './transaction';
5
+ export interface SendOptions {
6
+ to: Address | string;
7
+ value: BigNumber;
8
+ data?: string;
9
+ fee?: number;
10
+ }
11
+ export interface ChainProvider {
12
+ /**
13
+ * Generate a block
14
+ * @param {!number} numberOfBlocks - Number of blocks to be generated
15
+ * @return {<Promise>}
16
+ */
17
+ generateBlock(numberOfBlocks: number): Promise<void>;
18
+ /**
19
+ * Get a block given its hash.
20
+ * @param {!string} blockHash - A hexadecimal string that represents the
21
+ * *hash* of the desired block.
22
+ * @param {boolean} [includeTx=false] - If true, fetches transactions in the block.
23
+ * @return {Promise<Block, TypeError|InvalidProviderResponseError>}
24
+ * Resolves with a Block with the same hash as the given input.
25
+ * If `includeTx` is true, the transaction property is an array of Transactions;
26
+ * otherwise, it is a list of transaction hashes.
27
+ * Rejects with TypeError if input is invalid.
28
+ * Rejects with InvalidProviderResponseError if provider's response is invalid.
29
+ */
30
+ getBlockByHash(blockHash: string, includeTx?: boolean): Promise<Block>;
31
+ /**
32
+ * Get a block given its number.
33
+ * @param {!number} blockNumber - The number of the desired block.
34
+ * @param {boolean} [includeTx=false] - If true, fetches transaction in the block.
35
+ * @return {Promise<Block, TypeError|InvalidProviderResponseError>}
36
+ * Resolves with a Block with the same number as the given input.
37
+ * If `includeTx` is true, the transaction property is an array of Transactions;
38
+ * otherwise, it is a list of transaction hashes.
39
+ * Rejects with TypeError if input is invalid.
40
+ * Rejects with InvalidProviderResponseError if provider's response is invalid.
41
+ */
42
+ getBlockByNumber(blockNumber: number, includeTx?: boolean): Promise<Block>;
43
+ /**
44
+ * Get current block height of the chain.
45
+ * @return {Promise<number, InvalidProviderResponseError>} Resolves with
46
+ * chain height.
47
+ * Rejects with InvalidProviderResponseError if provider's response is invalid.
48
+ */
49
+ getBlockHeight(): Promise<number>;
50
+ /**
51
+ * Get a transaction given its hash.
52
+ * @param {!string} txHash - A hexadecimal string that represents the *hash* of the
53
+ * desired transaction.
54
+ * @return {Promise<Transaction, TypeError|InvalidProviderResponseError>}
55
+ * Resolves with a Transaction with the same hash as the given input.
56
+ * Rejects with TypeError if input is invalid.
57
+ * Rejects with InvalidProviderResponseError if provider's response is invalid.
58
+ */
59
+ getTransactionByHash(txHash: string): Promise<Transaction>;
60
+ /**
61
+ * Get the balance of an account given its addresses.
62
+ * @param {(string | Address)[]} addresses - A list of addresses.
63
+ * @return {Promise<BigNumber, InvalidProviderResponseError>} If addresses is given,
64
+ * returns the cumulative balance of the given addresses. Otherwise returns the balance
65
+ * of the addresses that the signing provider controls.
66
+ * Rejects with InvalidProviderResponseError if provider's response is invalid.
67
+ */
68
+ getBalance(addresses: (Address | string)[]): Promise<BigNumber>;
69
+ /**
70
+ * Create, sign & broadcast a transaction.
71
+ * @param {!string} to - Recepient address.
72
+ * @param {!number} value - Value of transaction.
73
+ * @param {!string} data - Data to be passed to the transaction.
74
+ * @param {!Fee} [fee] - Fee price in native unit (e.g. sat/b, wei)
75
+ * @return {Promise<Transaction>} Resolves with a signed transaction.
76
+ */
77
+ sendTransaction(options: SendOptions): Promise<Transaction>;
78
+ /**
79
+ * Create, sign & broadcast a sweep transaction.
80
+ * @param {!string} address - External address.
81
+ * @param {Fee} [fee] - Fee price in native unit (e.g. sat/b, wei)
82
+ * @return {Promise<Transaction>} Resolves with a signed transaction.
83
+ */
84
+ sendSweepTransaction(address: Address | string, fee?: number): Promise<Transaction>;
85
+ /**
86
+ * Update the fee of a transaction.
87
+ * @param {(string|Transaction)} tx - Transaction object or hash of the transaction to update
88
+ * @param {!Fee} newFee - New fee price in native unit (e.g. sat/b, wei)
89
+ * @return {Promise<Transaction>} Resolves with the new transaction
90
+ */
91
+ updateTransactionFee(tx: string | Transaction, newFee: number): Promise<Transaction>;
92
+ /**
93
+ * Create, sign & broad a transaction with multiple outputs.
94
+ * @param {string[]} transactions - to, value, data
95
+ * @return {Promise<Transaction>} Resolves with a signed transaction.
96
+ */
97
+ sendBatchTransaction(transactions: SendOptions[]): Promise<Transaction>;
98
+ /**
99
+ * Broadcast a signed transaction to the network.
100
+ * @param {!string} rawTransaction - A raw transaction usually in the form of a
101
+ * hexadecimal string that represents the serialized transaction.
102
+ * @return {Promise<string, InvalidProviderResponseError>} Resolves with an
103
+ * identifier for the broadcasted transaction.
104
+ * Rejects with InvalidProviderResponseError if provider's response is invalid.
105
+ */
106
+ sendRawTransaction(rawTransaction: string): Promise<string>;
107
+ }
package/dist/chain.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=chain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chain.js","sourceRoot":"","sources":["../lib/chain.ts"],"names":[],"mappings":""}
package/dist/fees.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ export interface FeeDetail {
2
+ fee: number;
3
+ wait?: number;
4
+ }
5
+ export interface FeeDetails {
6
+ slow: FeeDetail;
7
+ average: FeeDetail;
8
+ fast: FeeDetail;
9
+ }
10
+ export interface FeeProvider {
11
+ /**
12
+ * @return {Promise<FeeDetails>} Resolves with an
13
+ * identifier for the broadcasted transaction.
14
+ * Rejects with InvalidProviderResponseError if provider's response is invalid.
15
+ */
16
+ getFees(): Promise<FeeDetails>;
17
+ }
package/dist/fees.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=fees.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fees.js","sourceRoot":"","sources":["../lib/fees.ts"],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,16 @@
1
- import { Provider } from '@liquality/provider';
2
- import { ChainProvider, SwapProvider, WalletProvider } from '@liquality/types';
1
+ import BigNumber from 'bignumber.js';
2
+ import { Address } from './address';
3
+ import * as bitcoin from './bitcoin';
4
+ import { Block } from './block';
3
5
  import { CfdProvider } from './cfd';
6
+ import { ChainProvider, SendOptions } from './chain';
4
7
  import { DlcProvider } from './dlc';
5
- import { FinanceWalletProvider } from './financewallet';
6
- interface IFinanceClient {
8
+ import { FeeDetail, FeeDetails, FeeProvider } from './fees';
9
+ import * as BitcoinJsonRpcTypes from './jsonrpc';
10
+ import { Network } from './network';
11
+ import { Transaction, TxStatus } from './transaction';
12
+ import { WalletProvider } from './wallet';
13
+ interface IClient {
7
14
  /**
8
15
  * Helper method that returns method from a provider.
9
16
  * @param {!string} method - Name of the method to look for in the provider stack
@@ -12,18 +19,15 @@ interface IFinanceClient {
12
19
  * @return {function} Returns method from provider instance associated with the requested method
13
20
  */
14
21
  getMethod(method: string, requestor?: any): () => any;
15
- getProviderForMethod(method: string, requestor?: boolean): Provider;
22
+ getProviderForMethod(method: string, requestor?: boolean): any;
16
23
  chain: ChainProvider;
17
- swap: SwapProvider;
18
24
  wallet: WalletProvider;
19
25
  cfd: CfdProvider;
20
26
  dlc: DlcProvider;
21
- financewallet: FinanceWalletProvider;
22
27
  }
23
28
  export * from './cfd';
24
29
  export * from './common';
25
30
  export * from './dlc';
26
- export * from './financewallet';
27
31
  export { default as Amount } from './models/Amount';
28
32
  export { default as Input } from './models/Input';
29
33
  export { default as OracleInfo } from './models/OracleInfo';
@@ -31,4 +35,4 @@ export { default as Outcome } from './models/Outcome';
31
35
  export { default as Output } from './models/Output';
32
36
  export { default as Utxo } from './models/Utxo';
33
37
  export * from './wallet';
34
- export { IFinanceClient, CfdProvider, DlcProvider, FinanceWalletProvider };
38
+ export { BigNumber, IClient, CfdProvider, DlcProvider, ChainProvider, WalletProvider, Address, SendOptions, Block, Transaction, TxStatus, FeeDetails, FeeDetail, FeeProvider, Network, BitcoinJsonRpcTypes, bitcoin, };
package/dist/index.js CHANGED
@@ -6,6 +6,18 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
6
6
  if (k2 === undefined) k2 = k;
7
7
  o[k2] = m[k];
8
8
  }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
9
21
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
22
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
23
  };
@@ -13,11 +25,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
25
  return (mod && mod.__esModule) ? mod : { "default": mod };
14
26
  };
15
27
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.Utxo = exports.Output = exports.Outcome = exports.OracleInfo = exports.Input = exports.Amount = void 0;
28
+ exports.bitcoin = exports.BitcoinJsonRpcTypes = exports.TxStatus = exports.Address = exports.BigNumber = exports.Utxo = exports.Output = exports.Outcome = exports.OracleInfo = exports.Input = exports.Amount = void 0;
29
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
30
+ exports.BigNumber = bignumber_js_1.default;
31
+ const address_1 = require("./address");
32
+ Object.defineProperty(exports, "Address", { enumerable: true, get: function () { return address_1.Address; } });
33
+ const bitcoin = __importStar(require("./bitcoin"));
34
+ exports.bitcoin = bitcoin;
35
+ const BitcoinJsonRpcTypes = __importStar(require("./jsonrpc"));
36
+ exports.BitcoinJsonRpcTypes = BitcoinJsonRpcTypes;
37
+ const transaction_1 = require("./transaction");
38
+ Object.defineProperty(exports, "TxStatus", { enumerable: true, get: function () { return transaction_1.TxStatus; } });
17
39
  __exportStar(require("./cfd"), exports);
18
40
  __exportStar(require("./common"), exports);
19
41
  __exportStar(require("./dlc"), exports);
20
- __exportStar(require("./financewallet"), exports);
21
42
  var Amount_1 = require("./models/Amount");
22
43
  Object.defineProperty(exports, "Amount", { enumerable: true, get: function () { return __importDefault(Amount_1).default; } });
23
44
  var Input_1 = require("./models/Input");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA0BA,wCAAsB;AACtB,2CAAyB;AACzB,wCAAsB;AACtB,kDAAgC;AAChC,0CAAoD;AAA3C,iHAAA,OAAO,OAAU;AAC1B,wCAAkD;AAAzC,+GAAA,OAAO,OAAS;AACzB,kDAA4D;AAAnD,yHAAA,OAAO,OAAc;AAC9B,4CAAsD;AAA7C,mHAAA,OAAO,OAAW;AAC3B,0CAAoD;AAA3C,iHAAA,OAAO,OAAU;AAC1B,sCAAgD;AAAvC,6GAAA,OAAO,OAAQ;AACxB,2CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAAqC;AA0CnC,oBA1CK,sBAAS,CA0CL;AAxCX,uCAAoC;AA8ClC,wFA9CO,iBAAO,OA8CP;AA7CT,mDAAqC;AAuDnC,0BAAO;AAjDT,+DAAiD;AAgD/C,kDAAmB;AA9CrB,+CAAsD;AAyCpD,yFAzCoB,sBAAQ,OAyCpB;AArBV,wCAAsB;AACtB,2CAAyB;AACzB,wCAAsB;AACtB,0CAAoD;AAA3C,iHAAA,OAAO,OAAU;AAC1B,wCAAkD;AAAzC,+GAAA,OAAO,OAAS;AACzB,kDAA4D;AAAnD,yHAAA,OAAO,OAAc;AAC9B,4CAAsD;AAA7C,mHAAA,OAAO,OAAW;AAC3B,0CAAoD;AAA3C,iHAAA,OAAO,OAAU;AAC1B,sCAAgD;AAAvC,6GAAA,OAAO,OAAQ;AACxB,2CAAyB"}
@@ -0,0 +1,72 @@
1
+ import { Transaction } from './bitcoin';
2
+ export interface UTXO {
3
+ txid: string;
4
+ vout: number;
5
+ address: string;
6
+ label: string;
7
+ scriptPubKey: string;
8
+ amount: number;
9
+ confirmations: number;
10
+ redeemScript: string;
11
+ witnessScript: string;
12
+ spendable: boolean;
13
+ solvable: boolean;
14
+ desc: string;
15
+ safe: boolean;
16
+ }
17
+ export interface ReceivedByAddress {
18
+ involvesWatchOnly: boolean;
19
+ address: string;
20
+ account: string;
21
+ amount: number;
22
+ cofirmations: number;
23
+ label: string;
24
+ txids: string[];
25
+ }
26
+ export interface MinedTransaction extends Transaction {
27
+ blockhash: string;
28
+ confirmations: number;
29
+ blocktime: number;
30
+ number: number;
31
+ }
32
+ export interface FundRawResponse {
33
+ hex: string;
34
+ fee: number;
35
+ changepos: number;
36
+ }
37
+ export interface AddressInfo {
38
+ iswatchonly: boolean;
39
+ pubkey: string;
40
+ hdkeypath: string;
41
+ }
42
+ export declare type AddressGrouping = string[][];
43
+ export interface ReceivedByAddress {
44
+ involvesWatchonly: boolean;
45
+ address: string;
46
+ account: string;
47
+ amount: number;
48
+ confirmations: number;
49
+ label: string;
50
+ txids: string[];
51
+ }
52
+ export interface Block {
53
+ hash: string;
54
+ confirmations: number;
55
+ size: number;
56
+ strippedSize: number;
57
+ weight: number;
58
+ height: number;
59
+ version: number;
60
+ versionHex: string;
61
+ merkleroot: string;
62
+ tx: string[];
63
+ time: number;
64
+ mediantime: number;
65
+ nonce: number;
66
+ bits: string;
67
+ difficulty: number;
68
+ chainwork: string;
69
+ nTx: number;
70
+ previousblockhash: string;
71
+ nextblockhash?: string;
72
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=jsonrpc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonrpc.js","sourceRoot":"","sources":["../lib/jsonrpc.ts"],"names":[],"mappings":""}
@@ -1,18 +1,18 @@
1
- import { bitcoin as bT } from '@liquality/types';
1
+ import * as bT from '../bitcoin';
2
2
  import Utxo from './Utxo';
3
3
  /**
4
- * Class for interfacing with inputs/utxos in Liquality ChainAbstractionLayer
5
- * https://github.com/liquality/chainabstractionlayer
4
+ * Class for interfacing with inputs/utxos in Liquality Chainify
5
+ * https://github.com/liquality/chainify
6
6
  *
7
7
  * These inputs can have different fields for value
8
- * satoshis (sats): https://github.com/liquality/chainabstractionlayer/blob/dev/packages/bitcoin-esplora-api-provider/lib/BitcoinEsploraApiProvider.js#L65
9
- * amount (btc): https://github.com/liquality/chainabstractionlayer/blob/dev/packages/bitcoin-esplora-api-provider/lib/BitcoinEsploraApiProvider.js#L74
10
- * value (sats): https://github.com/liquality/chainabstractionlayer/blob/dev/packages/bitcoin-wallet-provider/lib/BitcoinWalletProvider.js#L331
8
+ * satoshis (sats): https://github.com/liquality/chainify/blob/dev/packages/bitcoin-esplora-api-provider/lib/BitcoinEsploraApiProvider.js#L65
9
+ * amount (btc): https://github.com/liquality/chainify/blob/dev/packages/bitcoin-esplora-api-provider/lib/BitcoinEsploraApiProvider.js#L74
10
+ * value (sats): https://github.com/liquality/chainify/blob/dev/packages/bitcoin-wallet-provider/lib/BitcoinWalletProvider.js#L331
11
11
  *
12
12
  * This will be fixed once typescript branch is merged:
13
- * https://github.com/liquality/chainabstractionlayer/tree/typescript
13
+ * https://github.com/liquality/chainify/tree/typescript
14
14
  * satoshis and amount will not be necessary, only value
15
- * https://github.com/liquality/chainabstractionlayer/blob/typescript/packages/types/lib/bitcoin.ts#L46
15
+ * https://github.com/liquality/chainify/blob/typescript/packages/types/lib/bitcoin.ts#L46
16
16
  */
17
17
  export default class Input {
18
18
  readonly txid: string;
@@ -6,18 +6,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Amount_1 = __importDefault(require("./Amount"));
7
7
  const Utxo_1 = __importDefault(require("./Utxo"));
8
8
  /**
9
- * Class for interfacing with inputs/utxos in Liquality ChainAbstractionLayer
10
- * https://github.com/liquality/chainabstractionlayer
9
+ * Class for interfacing with inputs/utxos in Liquality Chainify
10
+ * https://github.com/liquality/chainify
11
11
  *
12
12
  * These inputs can have different fields for value
13
- * satoshis (sats): https://github.com/liquality/chainabstractionlayer/blob/dev/packages/bitcoin-esplora-api-provider/lib/BitcoinEsploraApiProvider.js#L65
14
- * amount (btc): https://github.com/liquality/chainabstractionlayer/blob/dev/packages/bitcoin-esplora-api-provider/lib/BitcoinEsploraApiProvider.js#L74
15
- * value (sats): https://github.com/liquality/chainabstractionlayer/blob/dev/packages/bitcoin-wallet-provider/lib/BitcoinWalletProvider.js#L331
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
16
  *
17
17
  * This will be fixed once typescript branch is merged:
18
- * https://github.com/liquality/chainabstractionlayer/tree/typescript
18
+ * https://github.com/liquality/chainify/tree/typescript
19
19
  * satoshis and amount will not be necessary, only value
20
- * https://github.com/liquality/chainabstractionlayer/blob/typescript/packages/types/lib/bitcoin.ts#L46
20
+ * https://github.com/liquality/chainify/blob/typescript/packages/types/lib/bitcoin.ts#L46
21
21
  */
22
22
  class Input {
23
23
  constructor(txid, vout, address, amount, // in BTC
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sourceRoot":"","sources":["../../lib/models/Input.ts"],"names":[],"mappings":";;;;;AAEA,sDAA8B;AAC9B,kDAA0B;AAE1B;;;;;;;;;;;;;GAaG;AACH,MAAqB,KAAK;IACxB,YACW,IAAY,EACZ,IAAY,EACZ,OAAe,EACf,MAAc,EAAE,SAAS;IACzB,KAAa,EAAE,UAAU;IACzB,cAAuB,EACvB,gBAAyB,EACzB,YAAqB,EACrB,aAAsB,E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U;IACtB,CAAC;IAEJ,MAAM;QACJ,IAAI,MAAc,CAAC;QACnB,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,MAAM,GAAG,gBAAM,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC1C;aAAM,IAAI,IAAI,CAAC,MAAM,EAAE;YACtB,MAAM,GAAG,gBAAM,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC1C;QAED,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM;YACN,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG;YACrE,MAAM,EAAE,cAAI,CAAC,SAAS,CAAC,MAAM;YAC7B,OAAO,EAAE,cAAI,CAAC,SAAS,CAAC,OAAO;SAChC,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,IAAa;QAC3B,MAAM,MAAM,GAAW,gBAAM,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAEvD,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE,MAAM,CAAC,gBAAgB,EAAE;YACjC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM;SAC/B,CAAC;IACJ,CAAC;CACF;AAnDD,wBAmDC"}
@@ -0,0 +1,5 @@
1
+ export interface Network {
2
+ name: string;
3
+ coinType: string;
4
+ isTestnet: boolean;
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=network.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"network.js","sourceRoot":"","sources":["../lib/network.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ export interface Transaction<T = any> {
2
+ hash: string;
3
+ value: number;
4
+ status?: TxStatus;
5
+ blockHash?: string;
6
+ blockNumber?: number;
7
+ confirmations?: number;
8
+ feePrice?: number;
9
+ fee?: number;
10
+ secret?: string;
11
+ _raw: T;
12
+ }
13
+ export declare enum TxStatus {
14
+ Pending = "PENDING",
15
+ Failed = "FAILED",
16
+ Success = "SUCCESS"
17
+ }