@atomicfinance/types 2.4.2 → 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.
- package/.turbo/turbo-build.log +1 -0
- package/.turbo/turbo-lint.log +1 -0
- package/.turbo/turbo-lint:fix.log +45 -0
- package/.turbo/turbo-test.log +1 -0
- package/CHANGELOG.md +13 -0
- package/dist/address.d.ts +10 -0
- package/dist/address.js +11 -0
- package/dist/address.js.map +1 -0
- package/dist/bitcoin.d.ts +66 -0
- package/dist/bitcoin.js +16 -0
- package/dist/bitcoin.js.map +1 -0
- package/dist/block.d.ts +10 -0
- package/dist/{financewallet.js → block.js} +1 -1
- package/dist/block.js.map +1 -0
- package/dist/cfd.d.ts +0 -0
- package/dist/cfd.js +0 -0
- package/dist/cfd.js.map +0 -0
- package/dist/chain.d.ts +107 -0
- package/dist/chain.js +3 -0
- package/dist/chain.js.map +1 -0
- package/dist/common.d.ts +0 -0
- package/dist/common.js +0 -0
- package/dist/common.js.map +0 -0
- package/dist/dlc.d.ts +0 -0
- package/dist/dlc.js +0 -0
- package/dist/dlc.js.map +0 -0
- package/dist/fees.d.ts +17 -0
- package/dist/fees.js +3 -0
- package/dist/fees.js.map +1 -0
- package/dist/index.d.ts +13 -7
- package/dist/index.js +23 -2
- package/dist/index.js.map +1 -1
- package/dist/jsonrpc.d.ts +72 -0
- package/dist/jsonrpc.js +3 -0
- package/dist/jsonrpc.js.map +1 -0
- package/dist/models/Amount.d.ts +0 -0
- package/dist/models/Amount.js +0 -0
- package/dist/models/Amount.js.map +0 -0
- package/dist/models/Input.d.ts +8 -8
- package/dist/models/Input.js +7 -7
- package/dist/models/Input.js.map +1 -1
- package/dist/models/OracleInfo.d.ts +0 -0
- package/dist/models/OracleInfo.js +0 -0
- package/dist/models/OracleInfo.js.map +0 -0
- package/dist/models/Outcome.d.ts +0 -0
- package/dist/models/Outcome.js +0 -0
- package/dist/models/Outcome.js.map +0 -0
- package/dist/models/Output.d.ts +0 -0
- package/dist/models/Output.js +0 -0
- package/dist/models/Output.js.map +0 -0
- package/dist/models/Utxo.d.ts +0 -0
- package/dist/models/Utxo.js +0 -0
- package/dist/models/Utxo.js.map +0 -0
- package/dist/network.d.ts +5 -0
- package/dist/network.js +3 -0
- package/dist/network.js.map +1 -0
- package/dist/transaction.d.ts +17 -0
- package/dist/transaction.js +10 -0
- package/dist/transaction.js.map +1 -0
- package/dist/wallet.d.ts +78 -0
- package/dist/wallet.js +0 -0
- package/dist/wallet.js.map +0 -0
- package/lib/address.ts +13 -0
- package/lib/bitcoin.ts +72 -0
- package/lib/block.ts +18 -0
- package/lib/chain.ts +126 -0
- package/lib/fees.ts +21 -0
- package/lib/index.ts +31 -7
- package/lib/jsonrpc.ts +81 -0
- package/lib/models/Input.ts +8 -9
- package/lib/network.ts +5 -0
- package/lib/transaction.ts +28 -0
- package/lib/wallet.ts +109 -0
- package/package.json +7 -7
- package/LICENSE +0 -674
- package/dist/financewallet.d.ts +0 -10
- package/dist/financewallet.js.map +0 -1
- package/lib/financewallet.ts +0 -26
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@atomicfinance/types:build: cache hit, replaying output [2mca44072ac84d3b52[0m
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[34m@atomicfinance/types:lint: [0mcache hit, replaying output [2m8ec25e5b0a472eb9[0m
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
[32m@atomicfinance/types:lint:fix: [0mcache hit, replaying output [2m81d44a9a9a4a7e29[0m
|
|
2
|
+
[32m@atomicfinance/types:lint:fix: [0m
|
|
3
|
+
[32m@atomicfinance/types:lint:fix: [0m/Users/steven/src/atomicfinance/chainify-finance/packages/types/lib/block.ts
|
|
4
|
+
[32m@atomicfinance/types:lint:fix: [0m 1:42 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
5
|
+
[32m@atomicfinance/types:lint:fix: [0m
|
|
6
|
+
[32m@atomicfinance/types:lint:fix: [0m/Users/steven/src/atomicfinance/chainify-finance/packages/types/lib/dlc.ts
|
|
7
|
+
[32m@atomicfinance/types:lint:fix: [0m 288:11 warning 'ISig' is defined but never used @typescript-eslint/no-unused-vars
|
|
8
|
+
[32m@atomicfinance/types:lint:fix: [0m 303:11 warning 'FindOutcomeResponse' is defined but never used @typescript-eslint/no-unused-vars
|
|
9
|
+
[32m@atomicfinance/types:lint:fix: [0m
|
|
10
|
+
[32m@atomicfinance/types:lint:fix: [0m/Users/steven/src/atomicfinance/chainify-finance/packages/types/lib/index.ts
|
|
11
|
+
[32m@atomicfinance/types:lint:fix: [0m 23:41 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
12
|
+
[32m@atomicfinance/types:lint:fix: [0m 23:53 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
13
|
+
[32m@atomicfinance/types:lint:fix: [0m 24:62 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
14
|
+
[32m@atomicfinance/types:lint:fix: [0m
|
|
15
|
+
[32m@atomicfinance/types:lint:fix: [0m/Users/steven/src/atomicfinance/chainify-finance/packages/types/lib/models/Amount.ts
|
|
16
|
+
[32m@atomicfinance/types:lint:fix: [0m 15:3 warning Missing return type on function @typescript-eslint/explicit-module-boundary-types
|
|
17
|
+
[32m@atomicfinance/types:lint:fix: [0m 20:3 warning Missing return type on function @typescript-eslint/explicit-module-boundary-types
|
|
18
|
+
[32m@atomicfinance/types:lint:fix: [0m 25:3 warning Missing return type on function @typescript-eslint/explicit-module-boundary-types
|
|
19
|
+
[32m@atomicfinance/types:lint:fix: [0m 30:3 warning Missing return type on function @typescript-eslint/explicit-module-boundary-types
|
|
20
|
+
[32m@atomicfinance/types:lint:fix: [0m 36:3 warning Missing return type on function @typescript-eslint/explicit-module-boundary-types
|
|
21
|
+
[32m@atomicfinance/types:lint:fix: [0m 42:3 warning Missing return type on function @typescript-eslint/explicit-module-boundary-types
|
|
22
|
+
[32m@atomicfinance/types:lint:fix: [0m 47:3 warning Missing return type on function @typescript-eslint/explicit-module-boundary-types
|
|
23
|
+
[32m@atomicfinance/types:lint:fix: [0m 53:3 warning Missing return type on function @typescript-eslint/explicit-module-boundary-types
|
|
24
|
+
[32m@atomicfinance/types:lint:fix: [0m 72:31 warning Argument 'value' should be typed with a non-any type @typescript-eslint/explicit-module-boundary-types
|
|
25
|
+
[32m@atomicfinance/types:lint:fix: [0m 72:38 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
26
|
+
[32m@atomicfinance/types:lint:fix: [0m 72:44 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
27
|
+
[32m@atomicfinance/types:lint:fix: [0m
|
|
28
|
+
[32m@atomicfinance/types:lint:fix: [0m/Users/steven/src/atomicfinance/chainify-finance/packages/types/lib/models/Outcome.ts
|
|
29
|
+
[32m@atomicfinance/types:lint:fix: [0m 27:31 warning Argument 'value' should be typed with a non-any type @typescript-eslint/explicit-module-boundary-types
|
|
30
|
+
[32m@atomicfinance/types:lint:fix: [0m 27:38 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
31
|
+
[32m@atomicfinance/types:lint:fix: [0m 27:44 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
32
|
+
[32m@atomicfinance/types:lint:fix: [0m
|
|
33
|
+
[32m@atomicfinance/types:lint:fix: [0m/Users/steven/src/atomicfinance/chainify-finance/packages/types/lib/models/Utxo.ts
|
|
34
|
+
[32m@atomicfinance/types:lint:fix: [0m 54:31 warning Argument 'value' should be typed with a non-any type @typescript-eslint/explicit-module-boundary-types
|
|
35
|
+
[32m@atomicfinance/types:lint:fix: [0m 54:38 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
36
|
+
[32m@atomicfinance/types:lint:fix: [0m 54:44 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
37
|
+
[32m@atomicfinance/types:lint:fix: [0m
|
|
38
|
+
[32m@atomicfinance/types:lint:fix: [0m/Users/steven/src/atomicfinance/chainify-finance/packages/types/lib/transaction.ts
|
|
39
|
+
[32m@atomicfinance/types:lint:fix: [0m 1:34 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
40
|
+
[32m@atomicfinance/types:lint:fix: [0m
|
|
41
|
+
[32m@atomicfinance/types:lint:fix: [0m/Users/steven/src/atomicfinance/chainify-finance/packages/types/lib/wallet.ts
|
|
42
|
+
[32m@atomicfinance/types:lint:fix: [0m 74:34 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
43
|
+
[32m@atomicfinance/types:lint:fix: [0m
|
|
44
|
+
[32m@atomicfinance/types:lint:fix: [0m✖ 25 problems (0 errors, 25 warnings)
|
|
45
|
+
[32m@atomicfinance/types:lint:fix: [0m
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@atomicfinance/types:test: cache hit, replaying output [2mde5924699b821421[0m
|
package/CHANGELOG.md
ADDED
package/dist/address.js
ADDED
|
@@ -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
|
+
}
|
package/dist/bitcoin.js
ADDED
|
@@ -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"}
|
package/dist/block.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block.js","sourceRoot":"","sources":["../lib/block.ts"],"names":[],"mappings":""}
|
package/dist/cfd.d.ts
CHANGED
|
File without changes
|
package/dist/cfd.js
CHANGED
|
File without changes
|
package/dist/cfd.js.map
CHANGED
|
File without changes
|
package/dist/chain.d.ts
ADDED
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"chain.js","sourceRoot":"","sources":["../lib/chain.ts"],"names":[],"mappings":""}
|
package/dist/common.d.ts
CHANGED
|
File without changes
|
package/dist/common.js
CHANGED
|
File without changes
|
package/dist/common.js.map
CHANGED
|
File without changes
|
package/dist/dlc.d.ts
CHANGED
|
File without changes
|
package/dist/dlc.js
CHANGED
|
File without changes
|
package/dist/dlc.js.map
CHANGED
|
File without changes
|
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
package/dist/fees.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fees.js","sourceRoot":"","sources":["../lib/fees.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import BigNumber from 'bignumber.js';
|
|
2
|
+
import { Address } from './address';
|
|
3
|
+
import * as bitcoin from './bitcoin';
|
|
4
|
+
import { Block } from './block';
|
|
2
5
|
import { CfdProvider } from './cfd';
|
|
6
|
+
import { ChainProvider, SendOptions } from './chain';
|
|
3
7
|
import { DlcProvider } from './dlc';
|
|
4
|
-
import {
|
|
5
|
-
|
|
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 {
|
|
6
14
|
/**
|
|
7
15
|
* Helper method that returns method from a provider.
|
|
8
16
|
* @param {!string} method - Name of the method to look for in the provider stack
|
|
@@ -11,17 +19,15 @@ interface IFinanceClient {
|
|
|
11
19
|
* @return {function} Returns method from provider instance associated with the requested method
|
|
12
20
|
*/
|
|
13
21
|
getMethod(method: string, requestor?: any): () => any;
|
|
22
|
+
getProviderForMethod(method: string, requestor?: boolean): any;
|
|
14
23
|
chain: ChainProvider;
|
|
15
|
-
swap: SwapProvider;
|
|
16
24
|
wallet: WalletProvider;
|
|
17
25
|
cfd: CfdProvider;
|
|
18
26
|
dlc: DlcProvider;
|
|
19
|
-
financewallet: FinanceWalletProvider;
|
|
20
27
|
}
|
|
21
28
|
export * from './cfd';
|
|
22
29
|
export * from './common';
|
|
23
30
|
export * from './dlc';
|
|
24
|
-
export * from './financewallet';
|
|
25
31
|
export { default as Amount } from './models/Amount';
|
|
26
32
|
export { default as Input } from './models/Input';
|
|
27
33
|
export { default as OracleInfo } from './models/OracleInfo';
|
|
@@ -29,4 +35,4 @@ export { default as Outcome } from './models/Outcome';
|
|
|
29
35
|
export { default as Output } from './models/Output';
|
|
30
36
|
export { default as Utxo } from './models/Utxo';
|
|
31
37
|
export * from './wallet';
|
|
32
|
-
export {
|
|
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":"
|
|
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
|
+
}
|
package/dist/jsonrpc.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonrpc.js","sourceRoot":"","sources":["../lib/jsonrpc.ts"],"names":[],"mappings":""}
|
package/dist/models/Amount.d.ts
CHANGED
|
File without changes
|
package/dist/models/Amount.js
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/models/Input.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as bT from '../bitcoin';
|
|
2
2
|
import Utxo from './Utxo';
|
|
3
3
|
/**
|
|
4
|
-
* Class for interfacing with inputs/utxos in Liquality
|
|
5
|
-
* https://github.com/liquality/
|
|
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/
|
|
9
|
-
* amount (btc): https://github.com/liquality/
|
|
10
|
-
* value (sats): https://github.com/liquality/
|
|
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/
|
|
13
|
+
* https://github.com/liquality/chainify/tree/typescript
|
|
14
14
|
* satoshis and amount will not be necessary, only value
|
|
15
|
-
* https://github.com/liquality/
|
|
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;
|
package/dist/models/Input.js
CHANGED
|
@@ -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
|
|
10
|
-
* https://github.com/liquality/
|
|
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/
|
|
14
|
-
* amount (btc): https://github.com/liquality/
|
|
15
|
-
* value (sats): https://github.com/liquality/
|
|
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/
|
|
18
|
+
* https://github.com/liquality/chainify/tree/typescript
|
|
19
19
|
* satoshis and amount will not be necessary, only value
|
|
20
|
-
* https://github.com/liquality/
|
|
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
|
package/dist/models/Input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../lib/models/Input.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../lib/models/Input.ts"],"names":[],"mappings":";;;;;AACA,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,EACtB,YAAqB,EACrB,KAAc,EACd,aAAsB,EACtB,SAAmB,EACnB,QAAkB,EAClB,IAAc;QAdd,SAAI,GAAJ,IAAI,CAAQ;QACZ,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAQ;QACf,WAAM,GAAN,MAAM,CAAQ;QACd,UAAK,GAAL,KAAK,CAAQ;QACb,mBAAc,GAAd,cAAc,CAAS;QACvB,qBAAgB,GAAhB,gBAAgB,CAAS;QACzB,iBAAY,GAAZ,YAAY,CAAS;QACrB,kBAAa,GAAb,aAAa,CAAS;QACtB,iBAAY,GAAZ,YAAY,CAAS;QACrB,UAAK,GAAL,KAAK,CAAS;QACd,kBAAa,GAAb,aAAa,CAAS;QACtB,cAAS,GAAT,SAAS,CAAU;QACnB,aAAQ,GAAR,QAAQ,CAAU;QAClB,SAAI,GAAJ,IAAI,CAAU;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"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/models/Outcome.d.ts
CHANGED
|
File without changes
|
package/dist/models/Outcome.js
CHANGED
|
File without changes
|
|
File without changes
|