@xchainjs/xchain-utxo-providers 0.2.6 → 0.2.8
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/lib/index.esm.js +120 -2
- package/lib/index.js +119 -0
- package/lib/providers/bitgo/bitgo-api-types.d.ts +11 -0
- package/lib/providers/bitgo/bitgo-api.d.ts +8 -0
- package/lib/providers/bitgo/bitgo-data-provider.d.ts +41 -0
- package/lib/providers/blockcypher/blockcypher-api-types.d.ts +16 -0
- package/lib/providers/blockcypher/blockcypher-api.d.ts +11 -1
- package/lib/providers/blockcypher/blockcypher-data-provider.d.ts +6 -1
- package/lib/providers/haskoin/haskoin-data-provider.d.ts +5 -1
- package/lib/providers/index.d.ts +1 -0
- package/lib/providers/sochainv3/sochain-data-provider.d.ts +5 -1
- package/package.json +3 -3
package/lib/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assetAmount, assetToBase, baseAmount, delay } from '@xchainjs/xchain-util';
|
|
2
2
|
import axios from 'axios';
|
|
3
|
-
import { TxType } from '@xchainjs/xchain-client';
|
|
3
|
+
import { TxType, FeeOption } from '@xchainjs/xchain-client';
|
|
4
4
|
import PromisePool from '@supercharge/promise-pool';
|
|
5
5
|
|
|
6
6
|
var SochainNetwork;
|
|
@@ -298,6 +298,12 @@ class SochainProvider {
|
|
|
298
298
|
}
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
|
+
/**
|
|
302
|
+
* @throws {Error} Method not implemented.
|
|
303
|
+
*/
|
|
304
|
+
getFeeRates() {
|
|
305
|
+
throw new Error('Method not implemented.');
|
|
306
|
+
}
|
|
301
307
|
mapUTXOs(utxos) {
|
|
302
308
|
return utxos.map((utxo) => ({
|
|
303
309
|
hash: utxo.hash,
|
|
@@ -726,6 +732,12 @@ class HaskoinProvider {
|
|
|
726
732
|
}
|
|
727
733
|
});
|
|
728
734
|
}
|
|
735
|
+
/**
|
|
736
|
+
* @throws {Error} Method not implemented.
|
|
737
|
+
*/
|
|
738
|
+
getFeeRates() {
|
|
739
|
+
throw new Error('Method not implemented.');
|
|
740
|
+
}
|
|
729
741
|
/**
|
|
730
742
|
*
|
|
731
743
|
* @param utxos
|
|
@@ -817,6 +829,19 @@ const broadcastTx = ({ apiKey, baseUrl, network, txHex, }) => __awaiter(void 0,
|
|
|
817
829
|
const broadcastResponse = response.data;
|
|
818
830
|
return broadcastResponse.tx.hash;
|
|
819
831
|
});
|
|
832
|
+
/**
|
|
833
|
+
* Get general information about a blockchain
|
|
834
|
+
* @param {string} baseUrl The base url for the chain to interact with.
|
|
835
|
+
* @param {string} apiKey API key provided by Blockcypher.
|
|
836
|
+
* @returns {ChainResponse}
|
|
837
|
+
*/
|
|
838
|
+
const getBlockchainData = ({ baseUrl, apiKey, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
839
|
+
const params = {};
|
|
840
|
+
if (apiKey)
|
|
841
|
+
params['token'] = apiKey;
|
|
842
|
+
const chainResponse = yield axios.get(`${baseUrl}`, { params });
|
|
843
|
+
return chainResponse.data;
|
|
844
|
+
});
|
|
820
845
|
|
|
821
846
|
class BlockcypherProvider {
|
|
822
847
|
constructor(baseUrl = 'https://api.blockcypher.com/v1/', chain, asset, assetDecimals, blockcypherNetwork, apiKey) {
|
|
@@ -911,6 +936,23 @@ class BlockcypherProvider {
|
|
|
911
936
|
}
|
|
912
937
|
});
|
|
913
938
|
}
|
|
939
|
+
/**
|
|
940
|
+
* Returns a fee rate estimation from Blockcypher API service.
|
|
941
|
+
* @returns {FeeRates} Estimated fee rates
|
|
942
|
+
*/
|
|
943
|
+
getFeeRates() {
|
|
944
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
945
|
+
const chainResponse = yield getBlockchainData({
|
|
946
|
+
baseUrl: `${this.baseUrl}/${this.blockcypherNetwork}`,
|
|
947
|
+
apiKey: this._apiKey,
|
|
948
|
+
});
|
|
949
|
+
return {
|
|
950
|
+
[FeeOption.Average]: chainResponse.low_fee_per_kb / 1000,
|
|
951
|
+
[FeeOption.Fast]: chainResponse.medium_fee_per_kb / 1000,
|
|
952
|
+
[FeeOption.Fastest]: chainResponse.high_fee_per_kb / 1000,
|
|
953
|
+
};
|
|
954
|
+
});
|
|
955
|
+
}
|
|
914
956
|
mapTransactionToTx(rawTx) {
|
|
915
957
|
return {
|
|
916
958
|
asset: this.asset,
|
|
@@ -1037,4 +1079,80 @@ var BlockcypherNetwork;
|
|
|
1037
1079
|
BlockcypherNetwork["DASH"] = "dash/main";
|
|
1038
1080
|
})(BlockcypherNetwork || (BlockcypherNetwork = {}));
|
|
1039
1081
|
|
|
1040
|
-
|
|
1082
|
+
/**
|
|
1083
|
+
* Returns the estimated fee for a transaction. UTXO coins will return a fee per kB
|
|
1084
|
+
* @param {string} baseUrl Bitgo base url of chain to interact with. For example: https://app.bitgo.com/api/v2/btc
|
|
1085
|
+
* @param {GetFeeEstimateRequest} request Get fee estimate params
|
|
1086
|
+
* @returns {GetFeeEstimateResponse} Get fee estimate response
|
|
1087
|
+
*/
|
|
1088
|
+
const getFeeEstimate = (baseUrl, request) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1089
|
+
const response = yield axios.get(`${baseUrl}/tx/fee`, { params: request });
|
|
1090
|
+
return response.data;
|
|
1091
|
+
});
|
|
1092
|
+
|
|
1093
|
+
class BitgoProvider {
|
|
1094
|
+
constructor(config) {
|
|
1095
|
+
this.baseUrl = config.baseUrl;
|
|
1096
|
+
this.blockchainId = `${config.isTestnet ? 't' : ''}${config.chain.toLowerCase()}`;
|
|
1097
|
+
}
|
|
1098
|
+
/**
|
|
1099
|
+
* Returns a fee rate estimation from Bitgo API service. If low and medium rates can not be retrieve from node, the will be 50% and 75% of fastest fee rate
|
|
1100
|
+
* @returns {FeeRates} Estimated fee rates
|
|
1101
|
+
*/
|
|
1102
|
+
getFeeRates() {
|
|
1103
|
+
var _a, _b, _c, _d;
|
|
1104
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1105
|
+
const gasFeeEstimateResponse = yield getFeeEstimate(`${this.baseUrl}/api/v2/${this.blockchainId}`, {
|
|
1106
|
+
numBlocks: 2,
|
|
1107
|
+
});
|
|
1108
|
+
const fastestRate = gasFeeEstimateResponse.feePerKb / 1000;
|
|
1109
|
+
return {
|
|
1110
|
+
[FeeOption.Average]: ((_a = gasFeeEstimateResponse.feeByBlockTarget) === null || _a === void 0 ? void 0 : _a['6'])
|
|
1111
|
+
? ((_b = gasFeeEstimateResponse.feeByBlockTarget) === null || _b === void 0 ? void 0 : _b['6']) / 1000
|
|
1112
|
+
: fastestRate * 0.5,
|
|
1113
|
+
[FeeOption.Fast]: ((_c = gasFeeEstimateResponse.feeByBlockTarget) === null || _c === void 0 ? void 0 : _c['3'])
|
|
1114
|
+
? ((_d = gasFeeEstimateResponse.feeByBlockTarget) === null || _d === void 0 ? void 0 : _d['3']) / 1000
|
|
1115
|
+
: fastestRate * 0.75,
|
|
1116
|
+
[FeeOption.Fastest]: fastestRate,
|
|
1117
|
+
};
|
|
1118
|
+
});
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* @throws {Error} Method not implemented.
|
|
1122
|
+
*/
|
|
1123
|
+
getConfirmedUnspentTxs() {
|
|
1124
|
+
throw new Error('Method not implemented.');
|
|
1125
|
+
}
|
|
1126
|
+
/**
|
|
1127
|
+
* @throws {Error} Method not implemented.
|
|
1128
|
+
*/
|
|
1129
|
+
getUnspentTxs() {
|
|
1130
|
+
throw new Error('Method not implemented.');
|
|
1131
|
+
}
|
|
1132
|
+
/**
|
|
1133
|
+
* @throws {Error} Method not implemented.
|
|
1134
|
+
*/
|
|
1135
|
+
broadcastTx() {
|
|
1136
|
+
throw new Error('Method not implemented.');
|
|
1137
|
+
}
|
|
1138
|
+
/**
|
|
1139
|
+
* @throws {Error} Method not implemented.
|
|
1140
|
+
*/
|
|
1141
|
+
getBalance() {
|
|
1142
|
+
throw new Error('Method not implemented.');
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* @throws {Error} Method not implemented.
|
|
1146
|
+
*/
|
|
1147
|
+
getTransactions() {
|
|
1148
|
+
throw new Error('Method not implemented.');
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
* @throws {Error} Method not implemented.
|
|
1152
|
+
*/
|
|
1153
|
+
getTransactionData() {
|
|
1154
|
+
throw new Error('Method not implemented.');
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
export { BitgoProvider, BlockcypherNetwork, BlockcypherProvider, HaskoinNetwork, HaskoinProvider, SochainNetwork, SochainProvider, broadcastTx$1 as broadcastTx, getAccount, getAddress, getBalance$1 as getBalance, getConfirmedTxStatus, getConfirmedUnspentTxs, getIsTxConfirmed, getTx$1 as getTx, getTxs$1 as getTxs, getUnspentTxs };
|
package/lib/index.js
CHANGED
|
@@ -307,6 +307,12 @@ class SochainProvider {
|
|
|
307
307
|
}
|
|
308
308
|
});
|
|
309
309
|
}
|
|
310
|
+
/**
|
|
311
|
+
* @throws {Error} Method not implemented.
|
|
312
|
+
*/
|
|
313
|
+
getFeeRates() {
|
|
314
|
+
throw new Error('Method not implemented.');
|
|
315
|
+
}
|
|
310
316
|
mapUTXOs(utxos) {
|
|
311
317
|
return utxos.map((utxo) => ({
|
|
312
318
|
hash: utxo.hash,
|
|
@@ -735,6 +741,12 @@ class HaskoinProvider {
|
|
|
735
741
|
}
|
|
736
742
|
});
|
|
737
743
|
}
|
|
744
|
+
/**
|
|
745
|
+
* @throws {Error} Method not implemented.
|
|
746
|
+
*/
|
|
747
|
+
getFeeRates() {
|
|
748
|
+
throw new Error('Method not implemented.');
|
|
749
|
+
}
|
|
738
750
|
/**
|
|
739
751
|
*
|
|
740
752
|
* @param utxos
|
|
@@ -826,6 +838,19 @@ const broadcastTx = ({ apiKey, baseUrl, network, txHex, }) => __awaiter(void 0,
|
|
|
826
838
|
const broadcastResponse = response.data;
|
|
827
839
|
return broadcastResponse.tx.hash;
|
|
828
840
|
});
|
|
841
|
+
/**
|
|
842
|
+
* Get general information about a blockchain
|
|
843
|
+
* @param {string} baseUrl The base url for the chain to interact with.
|
|
844
|
+
* @param {string} apiKey API key provided by Blockcypher.
|
|
845
|
+
* @returns {ChainResponse}
|
|
846
|
+
*/
|
|
847
|
+
const getBlockchainData = ({ baseUrl, apiKey, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
848
|
+
const params = {};
|
|
849
|
+
if (apiKey)
|
|
850
|
+
params['token'] = apiKey;
|
|
851
|
+
const chainResponse = yield axios__default["default"].get(`${baseUrl}`, { params });
|
|
852
|
+
return chainResponse.data;
|
|
853
|
+
});
|
|
829
854
|
|
|
830
855
|
class BlockcypherProvider {
|
|
831
856
|
constructor(baseUrl = 'https://api.blockcypher.com/v1/', chain, asset, assetDecimals, blockcypherNetwork, apiKey) {
|
|
@@ -920,6 +945,23 @@ class BlockcypherProvider {
|
|
|
920
945
|
}
|
|
921
946
|
});
|
|
922
947
|
}
|
|
948
|
+
/**
|
|
949
|
+
* Returns a fee rate estimation from Blockcypher API service.
|
|
950
|
+
* @returns {FeeRates} Estimated fee rates
|
|
951
|
+
*/
|
|
952
|
+
getFeeRates() {
|
|
953
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
954
|
+
const chainResponse = yield getBlockchainData({
|
|
955
|
+
baseUrl: `${this.baseUrl}/${this.blockcypherNetwork}`,
|
|
956
|
+
apiKey: this._apiKey,
|
|
957
|
+
});
|
|
958
|
+
return {
|
|
959
|
+
[xchainClient.FeeOption.Average]: chainResponse.low_fee_per_kb / 1000,
|
|
960
|
+
[xchainClient.FeeOption.Fast]: chainResponse.medium_fee_per_kb / 1000,
|
|
961
|
+
[xchainClient.FeeOption.Fastest]: chainResponse.high_fee_per_kb / 1000,
|
|
962
|
+
};
|
|
963
|
+
});
|
|
964
|
+
}
|
|
923
965
|
mapTransactionToTx(rawTx) {
|
|
924
966
|
return {
|
|
925
967
|
asset: this.asset,
|
|
@@ -1046,6 +1088,83 @@ exports.BlockcypherNetwork = void 0;
|
|
|
1046
1088
|
BlockcypherNetwork["DASH"] = "dash/main";
|
|
1047
1089
|
})(exports.BlockcypherNetwork || (exports.BlockcypherNetwork = {}));
|
|
1048
1090
|
|
|
1091
|
+
/**
|
|
1092
|
+
* Returns the estimated fee for a transaction. UTXO coins will return a fee per kB
|
|
1093
|
+
* @param {string} baseUrl Bitgo base url of chain to interact with. For example: https://app.bitgo.com/api/v2/btc
|
|
1094
|
+
* @param {GetFeeEstimateRequest} request Get fee estimate params
|
|
1095
|
+
* @returns {GetFeeEstimateResponse} Get fee estimate response
|
|
1096
|
+
*/
|
|
1097
|
+
const getFeeEstimate = (baseUrl, request) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1098
|
+
const response = yield axios__default["default"].get(`${baseUrl}/tx/fee`, { params: request });
|
|
1099
|
+
return response.data;
|
|
1100
|
+
});
|
|
1101
|
+
|
|
1102
|
+
class BitgoProvider {
|
|
1103
|
+
constructor(config) {
|
|
1104
|
+
this.baseUrl = config.baseUrl;
|
|
1105
|
+
this.blockchainId = `${config.isTestnet ? 't' : ''}${config.chain.toLowerCase()}`;
|
|
1106
|
+
}
|
|
1107
|
+
/**
|
|
1108
|
+
* Returns a fee rate estimation from Bitgo API service. If low and medium rates can not be retrieve from node, the will be 50% and 75% of fastest fee rate
|
|
1109
|
+
* @returns {FeeRates} Estimated fee rates
|
|
1110
|
+
*/
|
|
1111
|
+
getFeeRates() {
|
|
1112
|
+
var _a, _b, _c, _d;
|
|
1113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1114
|
+
const gasFeeEstimateResponse = yield getFeeEstimate(`${this.baseUrl}/api/v2/${this.blockchainId}`, {
|
|
1115
|
+
numBlocks: 2,
|
|
1116
|
+
});
|
|
1117
|
+
const fastestRate = gasFeeEstimateResponse.feePerKb / 1000;
|
|
1118
|
+
return {
|
|
1119
|
+
[xchainClient.FeeOption.Average]: ((_a = gasFeeEstimateResponse.feeByBlockTarget) === null || _a === void 0 ? void 0 : _a['6'])
|
|
1120
|
+
? ((_b = gasFeeEstimateResponse.feeByBlockTarget) === null || _b === void 0 ? void 0 : _b['6']) / 1000
|
|
1121
|
+
: fastestRate * 0.5,
|
|
1122
|
+
[xchainClient.FeeOption.Fast]: ((_c = gasFeeEstimateResponse.feeByBlockTarget) === null || _c === void 0 ? void 0 : _c['3'])
|
|
1123
|
+
? ((_d = gasFeeEstimateResponse.feeByBlockTarget) === null || _d === void 0 ? void 0 : _d['3']) / 1000
|
|
1124
|
+
: fastestRate * 0.75,
|
|
1125
|
+
[xchainClient.FeeOption.Fastest]: fastestRate,
|
|
1126
|
+
};
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
/**
|
|
1130
|
+
* @throws {Error} Method not implemented.
|
|
1131
|
+
*/
|
|
1132
|
+
getConfirmedUnspentTxs() {
|
|
1133
|
+
throw new Error('Method not implemented.');
|
|
1134
|
+
}
|
|
1135
|
+
/**
|
|
1136
|
+
* @throws {Error} Method not implemented.
|
|
1137
|
+
*/
|
|
1138
|
+
getUnspentTxs() {
|
|
1139
|
+
throw new Error('Method not implemented.');
|
|
1140
|
+
}
|
|
1141
|
+
/**
|
|
1142
|
+
* @throws {Error} Method not implemented.
|
|
1143
|
+
*/
|
|
1144
|
+
broadcastTx() {
|
|
1145
|
+
throw new Error('Method not implemented.');
|
|
1146
|
+
}
|
|
1147
|
+
/**
|
|
1148
|
+
* @throws {Error} Method not implemented.
|
|
1149
|
+
*/
|
|
1150
|
+
getBalance() {
|
|
1151
|
+
throw new Error('Method not implemented.');
|
|
1152
|
+
}
|
|
1153
|
+
/**
|
|
1154
|
+
* @throws {Error} Method not implemented.
|
|
1155
|
+
*/
|
|
1156
|
+
getTransactions() {
|
|
1157
|
+
throw new Error('Method not implemented.');
|
|
1158
|
+
}
|
|
1159
|
+
/**
|
|
1160
|
+
* @throws {Error} Method not implemented.
|
|
1161
|
+
*/
|
|
1162
|
+
getTransactionData() {
|
|
1163
|
+
throw new Error('Method not implemented.');
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
exports.BitgoProvider = BitgoProvider;
|
|
1049
1168
|
exports.BlockcypherProvider = BlockcypherProvider;
|
|
1050
1169
|
exports.HaskoinProvider = HaskoinProvider;
|
|
1051
1170
|
exports.SochainProvider = SochainProvider;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type GetFeeEstimateRequest = {
|
|
2
|
+
numBlocks?: number;
|
|
3
|
+
};
|
|
4
|
+
export type GetFeeEstimateResponse = {
|
|
5
|
+
feePerKb: number;
|
|
6
|
+
cpfpFeePerKb?: number;
|
|
7
|
+
numBlocks: string;
|
|
8
|
+
confidence?: number;
|
|
9
|
+
multiplier?: number;
|
|
10
|
+
feeByBlockTarget?: Record<string, number>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GetFeeEstimateRequest, GetFeeEstimateResponse } from './bitgo-api-types';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the estimated fee for a transaction. UTXO coins will return a fee per kB
|
|
4
|
+
* @param {string} baseUrl Bitgo base url of chain to interact with. For example: https://app.bitgo.com/api/v2/btc
|
|
5
|
+
* @param {GetFeeEstimateRequest} request Get fee estimate params
|
|
6
|
+
* @returns {GetFeeEstimateResponse} Get fee estimate response
|
|
7
|
+
*/
|
|
8
|
+
export declare const getFeeEstimate: (baseUrl: string, request: GetFeeEstimateRequest) => Promise<GetFeeEstimateResponse>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Balance, FeeRates, Tx, TxsPage, UTXO, UtxoOnlineDataProvider } from '@xchainjs/xchain-client';
|
|
2
|
+
import { Chain } from '@xchainjs/xchain-util';
|
|
3
|
+
export interface BitgoConfig {
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
chain: Chain;
|
|
6
|
+
isTestnet?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class BitgoProvider implements UtxoOnlineDataProvider {
|
|
9
|
+
private baseUrl;
|
|
10
|
+
private blockchainId;
|
|
11
|
+
constructor(config: BitgoConfig);
|
|
12
|
+
/**
|
|
13
|
+
* Returns a fee rate estimation from Bitgo API service. If low and medium rates can not be retrieve from node, the will be 50% and 75% of fastest fee rate
|
|
14
|
+
* @returns {FeeRates} Estimated fee rates
|
|
15
|
+
*/
|
|
16
|
+
getFeeRates(): Promise<FeeRates>;
|
|
17
|
+
/**
|
|
18
|
+
* @throws {Error} Method not implemented.
|
|
19
|
+
*/
|
|
20
|
+
getConfirmedUnspentTxs(): Promise<UTXO[]>;
|
|
21
|
+
/**
|
|
22
|
+
* @throws {Error} Method not implemented.
|
|
23
|
+
*/
|
|
24
|
+
getUnspentTxs(): Promise<UTXO[]>;
|
|
25
|
+
/**
|
|
26
|
+
* @throws {Error} Method not implemented.
|
|
27
|
+
*/
|
|
28
|
+
broadcastTx(): Promise<string>;
|
|
29
|
+
/**
|
|
30
|
+
* @throws {Error} Method not implemented.
|
|
31
|
+
*/
|
|
32
|
+
getBalance(): Promise<Balance[]>;
|
|
33
|
+
/**
|
|
34
|
+
* @throws {Error} Method not implemented.
|
|
35
|
+
*/
|
|
36
|
+
getTransactions(): Promise<TxsPage>;
|
|
37
|
+
/**
|
|
38
|
+
* @throws {Error} Method not implemented.
|
|
39
|
+
*/
|
|
40
|
+
getTransactionData(): Promise<Tx>;
|
|
41
|
+
}
|
|
@@ -99,3 +99,19 @@ export type TxConfirmedStatus = {
|
|
|
99
99
|
confirmations: number;
|
|
100
100
|
is_confirmed: boolean;
|
|
101
101
|
};
|
|
102
|
+
export type Blockchain = {
|
|
103
|
+
name: string;
|
|
104
|
+
height: number;
|
|
105
|
+
hash: string;
|
|
106
|
+
time: string;
|
|
107
|
+
latest_url: string;
|
|
108
|
+
previous_hash: string;
|
|
109
|
+
previous_url: string;
|
|
110
|
+
high_fee_per_kb: number;
|
|
111
|
+
medium_fee_per_kb: number;
|
|
112
|
+
low_fee_per_kb: number;
|
|
113
|
+
unconfirmed_count: number;
|
|
114
|
+
last_fork_height?: number;
|
|
115
|
+
last_fork_hash?: number;
|
|
116
|
+
};
|
|
117
|
+
export type ChainResponse = Blockchain;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TxHash } from '@xchainjs/xchain-client';
|
|
2
2
|
import { BaseAmount } from '@xchainjs/xchain-util';
|
|
3
|
-
import { BalanceParams, BlockcypherNetwork, GetTxsDTO, Transaction, TxConfirmedStatus, TxHashParams } from './blockcypher-api-types';
|
|
3
|
+
import { BalanceParams, BlockcypherNetwork, ChainResponse, GetTxsDTO, Transaction, TxConfirmedStatus, TxHashParams } from './blockcypher-api-types';
|
|
4
4
|
/**
|
|
5
5
|
* Get transaction by hash.
|
|
6
6
|
*
|
|
@@ -67,3 +67,13 @@ export declare const broadcastTx: ({ apiKey, baseUrl, network, txHex, }: {
|
|
|
67
67
|
txHex: string;
|
|
68
68
|
network: BlockcypherNetwork;
|
|
69
69
|
}) => Promise<TxHash>;
|
|
70
|
+
/**
|
|
71
|
+
* Get general information about a blockchain
|
|
72
|
+
* @param {string} baseUrl The base url for the chain to interact with.
|
|
73
|
+
* @param {string} apiKey API key provided by Blockcypher.
|
|
74
|
+
* @returns {ChainResponse}
|
|
75
|
+
*/
|
|
76
|
+
export declare const getBlockchainData: ({ baseUrl, apiKey, }: {
|
|
77
|
+
baseUrl: string;
|
|
78
|
+
apiKey?: string | undefined;
|
|
79
|
+
}) => Promise<ChainResponse>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Balance, Tx, TxHash, TxHistoryParams, TxsPage, UTXO, UtxoOnlineDataProvider } from '@xchainjs/xchain-client';
|
|
1
|
+
import { Balance, FeeRates, Tx, TxHash, TxHistoryParams, TxsPage, UTXO, UtxoOnlineDataProvider } from '@xchainjs/xchain-client';
|
|
2
2
|
import { Address, Asset, Chain } from '@xchainjs/xchain-util';
|
|
3
3
|
import { BlockcypherNetwork } from './blockcypher-api-types';
|
|
4
4
|
export declare class BlockcypherProvider implements UtxoOnlineDataProvider {
|
|
@@ -30,6 +30,11 @@ export declare class BlockcypherProvider implements UtxoOnlineDataProvider {
|
|
|
30
30
|
* @returns {Tx} The transaction details of the given transaction id.
|
|
31
31
|
*/
|
|
32
32
|
getTransactionData(txId: string): Promise<Tx>;
|
|
33
|
+
/**
|
|
34
|
+
* Returns a fee rate estimation from Blockcypher API service.
|
|
35
|
+
* @returns {FeeRates} Estimated fee rates
|
|
36
|
+
*/
|
|
37
|
+
getFeeRates(): Promise<FeeRates>;
|
|
33
38
|
private mapTransactionToTx;
|
|
34
39
|
private mapUTXOs;
|
|
35
40
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Balance, Tx, TxHash, TxHistoryParams, TxsPage, UTXO, UtxoOnlineDataProvider } from '@xchainjs/xchain-client';
|
|
1
|
+
import { Balance, FeeRates, Tx, TxHash, TxHistoryParams, TxsPage, UTXO, UtxoOnlineDataProvider } from '@xchainjs/xchain-client';
|
|
2
2
|
import { Address, Asset, Chain } from '@xchainjs/xchain-util';
|
|
3
3
|
import { HaskoinNetwork } from './haskoin-api-types';
|
|
4
4
|
export declare class HaskoinProvider implements UtxoOnlineDataProvider {
|
|
@@ -28,6 +28,10 @@ export declare class HaskoinProvider implements UtxoOnlineDataProvider {
|
|
|
28
28
|
* @returns {Tx} The transaction details of the given transaction id.
|
|
29
29
|
*/
|
|
30
30
|
getTransactionData(txId: string): Promise<Tx>;
|
|
31
|
+
/**
|
|
32
|
+
* @throws {Error} Method not implemented.
|
|
33
|
+
*/
|
|
34
|
+
getFeeRates(): Promise<FeeRates>;
|
|
31
35
|
/**
|
|
32
36
|
*
|
|
33
37
|
* @param utxos
|
package/lib/providers/index.d.ts
CHANGED
|
@@ -6,3 +6,4 @@ export { getAddress, getBalance, getConfirmedTxStatus, getConfirmedUnspentTxs, g
|
|
|
6
6
|
export * from './haskoin/haskoin-data-provider';
|
|
7
7
|
export * from './blockcypher/blockcypher-data-provider';
|
|
8
8
|
export { BlockcypherNetwork } from './blockcypher/blockcypher-api-types';
|
|
9
|
+
export { BitgoProvider } from './bitgo/bitgo-data-provider';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Balance, Tx, TxHash, TxHistoryParams, TxsPage, UTXO, UtxoOnlineDataProvider } from '@xchainjs/xchain-client';
|
|
1
|
+
import { Balance, FeeRates, Tx, TxHash, TxHistoryParams, TxsPage, UTXO, UtxoOnlineDataProvider } from '@xchainjs/xchain-client';
|
|
2
2
|
import { Address, Asset, Chain } from '@xchainjs/xchain-util';
|
|
3
3
|
import { SochainNetwork } from './sochain-api-types';
|
|
4
4
|
export declare class SochainProvider implements UtxoOnlineDataProvider {
|
|
@@ -30,6 +30,10 @@ export declare class SochainProvider implements UtxoOnlineDataProvider {
|
|
|
30
30
|
* @returns {Tx} The transaction details of the given transaction id.
|
|
31
31
|
*/
|
|
32
32
|
getTransactionData(txId: string): Promise<Tx>;
|
|
33
|
+
/**
|
|
34
|
+
* @throws {Error} Method not implemented.
|
|
35
|
+
*/
|
|
36
|
+
getFeeRates(): Promise<FeeRates>;
|
|
33
37
|
private mapUTXOs;
|
|
34
38
|
/**
|
|
35
39
|
* helper function tto limit adding to an array
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-utxo-providers",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.esm.js",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@xchainjs/xchain-client": "^0.15.
|
|
30
|
+
"@xchainjs/xchain-client": "^0.15.4",
|
|
31
31
|
"@xchainjs/xchain-crypto": "^0.3.0",
|
|
32
32
|
"@xchainjs/xchain-util": "^0.13.1",
|
|
33
33
|
"axios": "^1.3.6"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@xchainjs/xchain-client": "^0.15.
|
|
36
|
+
"@xchainjs/xchain-client": "^0.15.4",
|
|
37
37
|
"@xchainjs/xchain-crypto": "^0.3.0",
|
|
38
38
|
"@xchainjs/xchain-util": "^0.13.1",
|
|
39
39
|
"axios": "^1.3.6"
|