@xchainjs/xchain-utxo-providers 0.1.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/README.md +72 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +14 -0
- package/lib/index.js.map +1 -0
- package/lib/providers/blockcypher/blockcypher-api-types.d.ts +96 -0
- package/lib/providers/blockcypher/blockcypher-api-types.js +11 -0
- package/lib/providers/blockcypher/blockcypher-api-types.js.map +1 -0
- package/lib/providers/blockcypher/blockcypher-api.d.ts +69 -0
- package/lib/providers/blockcypher/blockcypher-api.js +233 -0
- package/lib/providers/blockcypher/blockcypher-api.js.map +1 -0
- package/lib/providers/blockcypher/blockcypher-data-provider.d.ts +52 -0
- package/lib/providers/blockcypher/blockcypher-data-provider.js +366 -0
- package/lib/providers/blockcypher/blockcypher-data-provider.js.map +1 -0
- package/lib/providers/haskoin/haskoin-api-types.d.ts +113 -0
- package/lib/providers/haskoin/haskoin-api-types.js +14 -0
- package/lib/providers/haskoin/haskoin-api-types.js.map +1 -0
- package/lib/providers/haskoin/haskoin-api.d.ts +150 -0
- package/lib/providers/haskoin/haskoin-api.js +485 -0
- package/lib/providers/haskoin/haskoin-api.js.map +1 -0
- package/lib/providers/haskoin/haskoin-data-provider.d.ts +37 -0
- package/lib/providers/haskoin/haskoin-data-provider.js +269 -0
- package/lib/providers/haskoin/haskoin-data-provider.js.map +1 -0
- package/lib/providers/index.d.ts +8 -0
- package/lib/providers/index.js +34 -0
- package/lib/providers/index.js.map +1 -0
- package/lib/providers/sochainv3/sochain-api-types.d.ts +101 -0
- package/lib/providers/sochainv3/sochain-api-types.js +13 -0
- package/lib/providers/sochainv3/sochain-api-types.js.map +1 -0
- package/lib/providers/sochainv3/sochain-api.d.ts +113 -0
- package/lib/providers/sochainv3/sochain-api.js +354 -0
- package/lib/providers/sochainv3/sochain-api.js.map +1 -0
- package/lib/providers/sochainv3/sochain-data-provider.d.ts +42 -0
- package/lib/providers/sochainv3/sochain-data-provider.js +312 -0
- package/lib/providers/sochainv3/sochain-data-provider.js.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Module to interact with Haskoin API
|
|
4
|
+
*
|
|
5
|
+
* Doc (SwaggerHub) https://app.swaggerhub.com/apis/eligecode/blockchain-api/0.0.1-oas3
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
18
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
19
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
20
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
21
|
+
function step(op) {
|
|
22
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
23
|
+
while (_) try {
|
|
24
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
25
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
26
|
+
switch (op[0]) {
|
|
27
|
+
case 0: case 1: t = op; break;
|
|
28
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
29
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
30
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
31
|
+
default:
|
|
32
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
33
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
34
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
35
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
36
|
+
if (t[2]) _.ops.pop();
|
|
37
|
+
_.trys.pop(); continue;
|
|
38
|
+
}
|
|
39
|
+
op = body.call(thisArg, _);
|
|
40
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
41
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.broadcastTx = exports.getUnspentTransactions = exports.getTxHex = exports.getConfirmedUnspentTxs = exports.getConfirmedTxStatus = exports.getIsTxConfirmed = exports.getUnspentTxs = exports.getBalance = exports.getTxs = exports.getRawTransaction = exports.getTx = exports.getAddress = exports.getAccount = void 0;
|
|
49
|
+
var xchain_util_1 = require("@xchainjs/xchain-util");
|
|
50
|
+
var axios_1 = __importDefault(require("axios"));
|
|
51
|
+
/**
|
|
52
|
+
* Check error response.
|
|
53
|
+
*
|
|
54
|
+
* @param {any} response The api response.
|
|
55
|
+
* @returns {boolean}
|
|
56
|
+
*/
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
58
|
+
var isErrorResponse = function (response) {
|
|
59
|
+
return !!response.error;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Get account from address.
|
|
63
|
+
*
|
|
64
|
+
* @param {string} haskoinUrl The haskoin API url.
|
|
65
|
+
* @param {string} address The BCH address.
|
|
66
|
+
* @returns {AddressBalance}
|
|
67
|
+
*
|
|
68
|
+
* @throws {"failed to query account by a given address"} thrown if failed to query account by a given address
|
|
69
|
+
*/
|
|
70
|
+
var getAccount = function (_a) {
|
|
71
|
+
var haskoinUrl = _a.haskoinUrl, network = _a.network, address = _a.address;
|
|
72
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
73
|
+
var url, result;
|
|
74
|
+
return __generator(this, function (_b) {
|
|
75
|
+
switch (_b.label) {
|
|
76
|
+
case 0:
|
|
77
|
+
url = haskoinUrl + "/" + network + "/address/" + address + "/balance";
|
|
78
|
+
return [4 /*yield*/, axios_1.default.get(url)];
|
|
79
|
+
case 1:
|
|
80
|
+
result = (_b.sent()).data;
|
|
81
|
+
if (!result || isErrorResponse(result))
|
|
82
|
+
throw new Error("failed to query account by given address " + address);
|
|
83
|
+
return [2 /*return*/, result];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
exports.getAccount = getAccount;
|
|
89
|
+
/**
|
|
90
|
+
* Get address information.
|
|
91
|
+
*
|
|
92
|
+
* @param {string} haskoinUrl The haskoin node url.
|
|
93
|
+
* @param {string} network
|
|
94
|
+
* @param {string} address
|
|
95
|
+
* @returns {AddressDTO}
|
|
96
|
+
*/
|
|
97
|
+
var getAddress = function (_a) {
|
|
98
|
+
var haskoinUrl = _a.haskoinUrl, network = _a.network, address = _a.address;
|
|
99
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
100
|
+
var url, response, addressResponse;
|
|
101
|
+
return __generator(this, function (_b) {
|
|
102
|
+
switch (_b.label) {
|
|
103
|
+
case 0:
|
|
104
|
+
url = haskoinUrl + "/" + network + "/address/" + address + "/balance";
|
|
105
|
+
return [4 /*yield*/, axios_1.default.get(url)];
|
|
106
|
+
case 1:
|
|
107
|
+
response = _b.sent();
|
|
108
|
+
addressResponse = response.data;
|
|
109
|
+
return [2 /*return*/, addressResponse.data];
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
exports.getAddress = getAddress;
|
|
115
|
+
/**
|
|
116
|
+
* Get transaction by hash.
|
|
117
|
+
*
|
|
118
|
+
* @param {string} haskoinUrl The haskoin API url.
|
|
119
|
+
* @param {string} txId The transaction id.
|
|
120
|
+
* @returns {Transaction}
|
|
121
|
+
*
|
|
122
|
+
* @throws {"failed to query transaction by a given hash"} thrown if failed to query transaction by a given hash
|
|
123
|
+
*/
|
|
124
|
+
var getTx = function (_a) {
|
|
125
|
+
var haskoinUrl = _a.haskoinUrl, txId = _a.txId, network = _a.network;
|
|
126
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
127
|
+
var result;
|
|
128
|
+
return __generator(this, function (_b) {
|
|
129
|
+
switch (_b.label) {
|
|
130
|
+
case 0: return [4 /*yield*/, axios_1.default.get(haskoinUrl + "/" + network + "/transaction/" + txId)];
|
|
131
|
+
case 1:
|
|
132
|
+
result = (_b.sent()).data;
|
|
133
|
+
if (!result || isErrorResponse(result))
|
|
134
|
+
throw new Error("failed to query transaction by a given hash " + txId);
|
|
135
|
+
return [2 /*return*/, result];
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
exports.getTx = getTx;
|
|
141
|
+
/**
|
|
142
|
+
* Get raw transaction by hash.
|
|
143
|
+
*
|
|
144
|
+
* @param {string} haskoinUrl The haskoin API url.
|
|
145
|
+
* @param {string} txId The transaction id.
|
|
146
|
+
* @returns {Transaction}
|
|
147
|
+
*
|
|
148
|
+
* @throws {"failed to query transaction by a given hash"} thrown if failed to query raw transaction by a given hash
|
|
149
|
+
*/
|
|
150
|
+
var getRawTransaction = function (_a) {
|
|
151
|
+
var haskoinUrl = _a.haskoinUrl, network = _a.network, txId = _a.txId;
|
|
152
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
153
|
+
var result;
|
|
154
|
+
return __generator(this, function (_b) {
|
|
155
|
+
switch (_b.label) {
|
|
156
|
+
case 0: return [4 /*yield*/, axios_1.default.get(haskoinUrl + "/" + network + "/transaction/" + txId + "/raw")];
|
|
157
|
+
case 1:
|
|
158
|
+
result = (_b.sent())
|
|
159
|
+
.data;
|
|
160
|
+
if (!result || isErrorResponse(result))
|
|
161
|
+
throw new Error("failed to query transaction by a given hash " + txId);
|
|
162
|
+
return [2 /*return*/, result.result];
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
exports.getRawTransaction = getRawTransaction;
|
|
168
|
+
/**
|
|
169
|
+
* Get transactions
|
|
170
|
+
*
|
|
171
|
+
* @see https://haskoin.com/api#get-tx
|
|
172
|
+
*
|
|
173
|
+
* @param {string} haskoinUrl The haskoin node url.
|
|
174
|
+
* @param {string} network network id
|
|
175
|
+
* @param {string} hash The transaction hash.
|
|
176
|
+
* @returns {Transactions}
|
|
177
|
+
*/
|
|
178
|
+
var getTxs = function (_a) {
|
|
179
|
+
var address = _a.address, haskoinUrl = _a.haskoinUrl, network = _a.network, limit = _a.limit, offset = _a.offset;
|
|
180
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
181
|
+
var params, url, result;
|
|
182
|
+
return __generator(this, function (_b) {
|
|
183
|
+
switch (_b.label) {
|
|
184
|
+
case 0:
|
|
185
|
+
params = { limit: "" + limit, offset: "" + offset };
|
|
186
|
+
url = haskoinUrl + "/" + network + "/address/" + address + "/transactions/full";
|
|
187
|
+
return [4 /*yield*/, axios_1.default.get(url, { params: params })];
|
|
188
|
+
case 1:
|
|
189
|
+
result = (_b.sent()).data;
|
|
190
|
+
if (!result || isErrorResponse(result))
|
|
191
|
+
throw new Error('failed to query transactions');
|
|
192
|
+
return [2 /*return*/, result];
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
exports.getTxs = getTxs;
|
|
198
|
+
/**
|
|
199
|
+
*
|
|
200
|
+
* @param param
|
|
201
|
+
* @returns Returns BaseAmount
|
|
202
|
+
*/
|
|
203
|
+
var getBalance = function (_a) {
|
|
204
|
+
var haskoinUrl = _a.haskoinUrl, haskoinNetwork = _a.haskoinNetwork, address = _a.address, confirmedOnly = _a.confirmedOnly, assetDecimals = _a.assetDecimals;
|
|
205
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
206
|
+
var _b, confirmed, unconfirmed, confirmedAmount, unconfirmedAmount;
|
|
207
|
+
return __generator(this, function (_c) {
|
|
208
|
+
switch (_c.label) {
|
|
209
|
+
case 0: return [4 /*yield*/, axios_1.default.get(haskoinUrl + "/" + haskoinNetwork + "/address/" + address + "/balance")];
|
|
210
|
+
case 1:
|
|
211
|
+
_b = (_c.sent()).data, confirmed = _b.confirmed, unconfirmed = _b.unconfirmed;
|
|
212
|
+
confirmedAmount = xchain_util_1.baseAmount(confirmed, assetDecimals);
|
|
213
|
+
unconfirmedAmount = xchain_util_1.baseAmount(unconfirmed, assetDecimals);
|
|
214
|
+
return [2 /*return*/, confirmedOnly ? confirmedAmount : confirmedAmount.plus(unconfirmedAmount)];
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
exports.getBalance = getBalance;
|
|
220
|
+
/**
|
|
221
|
+
* Get unspent transactions.
|
|
222
|
+
*
|
|
223
|
+
* @param {string} haskoinUrl The haskoin API url.
|
|
224
|
+
* @param {string} address The BCH address.
|
|
225
|
+
* @returns {TxUnspent[]}
|
|
226
|
+
*
|
|
227
|
+
* @throws {"failed to query unspent transactions"} thrown if failed to query unspent transactions
|
|
228
|
+
*/
|
|
229
|
+
var getUnspentTxs = function (_a) {
|
|
230
|
+
var haskoinUrl = _a.haskoinUrl, network = _a.network, address = _a.address;
|
|
231
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
232
|
+
var account, result;
|
|
233
|
+
return __generator(this, function (_b) {
|
|
234
|
+
switch (_b.label) {
|
|
235
|
+
case 0: return [4 /*yield*/, exports.getAccount({ haskoinUrl: haskoinUrl, network: network, address: address })
|
|
236
|
+
// Set limit to the transaction count to be all the utxos.
|
|
237
|
+
];
|
|
238
|
+
case 1:
|
|
239
|
+
account = _b.sent();
|
|
240
|
+
return [4 /*yield*/, axios_1.default.get(haskoinUrl + "/" + network + "/address/" + address + "/unspent?limit" + (account === null || account === void 0 ? void 0 : account.utxo))];
|
|
241
|
+
case 2:
|
|
242
|
+
result = (_b.sent()).data;
|
|
243
|
+
if (!result || isErrorResponse(result))
|
|
244
|
+
throw new Error('failed to query unspent transactions');
|
|
245
|
+
return [2 /*return*/, result];
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
exports.getUnspentTxs = getUnspentTxs;
|
|
251
|
+
/**
|
|
252
|
+
* Get Tx Confirmation status
|
|
253
|
+
*
|
|
254
|
+
* @param {string} haskoinUrl The haskoin node url.
|
|
255
|
+
* @param {Network} network
|
|
256
|
+
* @param {string} hash tx id
|
|
257
|
+
* @returns {TxConfirmedStatus}
|
|
258
|
+
*/
|
|
259
|
+
var getIsTxConfirmed = function (_a) {
|
|
260
|
+
var haskoinUrl = _a.haskoinUrl, network = _a.network, txId = _a.txId;
|
|
261
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
262
|
+
var tx;
|
|
263
|
+
return __generator(this, function (_b) {
|
|
264
|
+
switch (_b.label) {
|
|
265
|
+
case 0: return [4 /*yield*/, exports.getTx({ haskoinUrl: haskoinUrl, network: network, txId: txId })];
|
|
266
|
+
case 1:
|
|
267
|
+
tx = _b.sent();
|
|
268
|
+
return [2 /*return*/, {
|
|
269
|
+
network: network,
|
|
270
|
+
txid: txId,
|
|
271
|
+
confirmations: tx.confirmations,
|
|
272
|
+
is_confirmed: tx.confirmations >= 1,
|
|
273
|
+
}];
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
exports.getIsTxConfirmed = getIsTxConfirmed;
|
|
279
|
+
/**
|
|
280
|
+
* List of confirmed txs
|
|
281
|
+
*
|
|
282
|
+
* Stores a list of confirmed txs (hashes) in memory to avoid requesting same data
|
|
283
|
+
*/
|
|
284
|
+
var confirmedTxs = [];
|
|
285
|
+
/**
|
|
286
|
+
* Helper to get `confirmed` status of a tx.
|
|
287
|
+
*
|
|
288
|
+
* It will get it from cache or try to get it from haskoin (if not cached before)
|
|
289
|
+
*/
|
|
290
|
+
var getConfirmedTxStatus = function (_a) {
|
|
291
|
+
var txHash = _a.txHash, haskoinUrl = _a.haskoinUrl, network = _a.network;
|
|
292
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
293
|
+
var is_confirmed;
|
|
294
|
+
return __generator(this, function (_b) {
|
|
295
|
+
switch (_b.label) {
|
|
296
|
+
case 0:
|
|
297
|
+
// try to get it from cache
|
|
298
|
+
if (confirmedTxs.includes(txHash))
|
|
299
|
+
return [2 /*return*/, true
|
|
300
|
+
// or get status from haskoin
|
|
301
|
+
];
|
|
302
|
+
return [4 /*yield*/, exports.getIsTxConfirmed({
|
|
303
|
+
haskoinUrl: haskoinUrl,
|
|
304
|
+
network: network,
|
|
305
|
+
txId: txHash,
|
|
306
|
+
})
|
|
307
|
+
// cache status
|
|
308
|
+
];
|
|
309
|
+
case 1:
|
|
310
|
+
is_confirmed = (_b.sent()).is_confirmed;
|
|
311
|
+
// cache status
|
|
312
|
+
confirmedTxs.push(txHash);
|
|
313
|
+
return [2 /*return*/, is_confirmed];
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
};
|
|
318
|
+
exports.getConfirmedTxStatus = getConfirmedTxStatus;
|
|
319
|
+
/**
|
|
320
|
+
* Get unspent txs and filter out pending UTXOs
|
|
321
|
+
*
|
|
322
|
+
* @see https://haskoin.com/api#get-unspent-tx
|
|
323
|
+
*
|
|
324
|
+
* @param {string} haskoinUrl The haskoin node url.
|
|
325
|
+
* @param {Network} network
|
|
326
|
+
* @param {string} address
|
|
327
|
+
* @returns {AddressUTXO[]}
|
|
328
|
+
*/
|
|
329
|
+
var getConfirmedUnspentTxs = function (_a) {
|
|
330
|
+
var haskoinUrl = _a.haskoinUrl, network = _a.network, address = _a.address;
|
|
331
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
332
|
+
var txs, confirmedUTXOs;
|
|
333
|
+
return __generator(this, function (_b) {
|
|
334
|
+
switch (_b.label) {
|
|
335
|
+
case 0: return [4 /*yield*/, exports.getUnspentTxs({
|
|
336
|
+
haskoinUrl: haskoinUrl,
|
|
337
|
+
network: network,
|
|
338
|
+
address: address,
|
|
339
|
+
})];
|
|
340
|
+
case 1:
|
|
341
|
+
txs = _b.sent();
|
|
342
|
+
confirmedUTXOs = [];
|
|
343
|
+
return [4 /*yield*/, Promise.all(txs.map(function (tx) { return __awaiter(void 0, void 0, void 0, function () {
|
|
344
|
+
var confirmed;
|
|
345
|
+
return __generator(this, function (_a) {
|
|
346
|
+
switch (_a.label) {
|
|
347
|
+
case 0: return [4 /*yield*/, exports.getConfirmedTxStatus({
|
|
348
|
+
haskoinUrl: haskoinUrl,
|
|
349
|
+
network: network,
|
|
350
|
+
txHash: tx.txid,
|
|
351
|
+
})];
|
|
352
|
+
case 1:
|
|
353
|
+
confirmed = _a.sent();
|
|
354
|
+
if (confirmed) {
|
|
355
|
+
confirmedUTXOs.push(tx);
|
|
356
|
+
}
|
|
357
|
+
return [2 /*return*/];
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
}); }))];
|
|
361
|
+
case 2:
|
|
362
|
+
_b.sent();
|
|
363
|
+
return [2 /*return*/, confirmedUTXOs];
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
};
|
|
368
|
+
exports.getConfirmedUnspentTxs = getConfirmedUnspentTxs;
|
|
369
|
+
// Stores list of txHex in memory to avoid requesting same data
|
|
370
|
+
var txHexMap = {};
|
|
371
|
+
/**
|
|
372
|
+
* Helper to get `hex` of `Tx`
|
|
373
|
+
*
|
|
374
|
+
* It will try to get it from cache before requesting it from Sochain
|
|
375
|
+
*/
|
|
376
|
+
var getTxHex = function (_a) {
|
|
377
|
+
var haskoinUrl = _a.haskoinUrl, network = _a.network, txId = _a.txId;
|
|
378
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
379
|
+
var txHex;
|
|
380
|
+
return __generator(this, function (_b) {
|
|
381
|
+
switch (_b.label) {
|
|
382
|
+
case 0:
|
|
383
|
+
txHex = txHexMap[txId];
|
|
384
|
+
if (!!txHex)
|
|
385
|
+
return [2 /*return*/, txHex
|
|
386
|
+
// or get it from Haskoin
|
|
387
|
+
];
|
|
388
|
+
return [4 /*yield*/, exports.getRawTransaction({ haskoinUrl: haskoinUrl, txId: txId, network: network })
|
|
389
|
+
// cache it
|
|
390
|
+
];
|
|
391
|
+
case 1:
|
|
392
|
+
// or get it from Haskoin
|
|
393
|
+
txHex = _b.sent();
|
|
394
|
+
// cache it
|
|
395
|
+
txHexMap[txId] = txHex;
|
|
396
|
+
return [2 /*return*/, txHex];
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
});
|
|
400
|
+
};
|
|
401
|
+
exports.getTxHex = getTxHex;
|
|
402
|
+
/**
|
|
403
|
+
* Get unspent transactions.
|
|
404
|
+
*
|
|
405
|
+
* @param {string} haskoinUrl The haskoin API url.
|
|
406
|
+
* @param {string} address The BCH address.
|
|
407
|
+
* @returns {TxUnspent[]}
|
|
408
|
+
*
|
|
409
|
+
* @throws {"failed to query unspent transactions"} thrown if failed to query unspent transactions
|
|
410
|
+
*/
|
|
411
|
+
var getUnspentTransactions = function (_a) {
|
|
412
|
+
var haskoinUrl = _a.haskoinUrl, network = _a.network, address = _a.address;
|
|
413
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
414
|
+
var account, result;
|
|
415
|
+
return __generator(this, function (_b) {
|
|
416
|
+
switch (_b.label) {
|
|
417
|
+
case 0: return [4 /*yield*/, exports.getAccount({ haskoinUrl: haskoinUrl, network: network, address: address })
|
|
418
|
+
// Set limit to the transaction count to be all the utxos.
|
|
419
|
+
];
|
|
420
|
+
case 1:
|
|
421
|
+
account = _b.sent();
|
|
422
|
+
return [4 /*yield*/, axios_1.default.get(haskoinUrl + "/" + network + "/address/" + address + "/unspent?limit" + (account === null || account === void 0 ? void 0 : account.utxo))];
|
|
423
|
+
case 2:
|
|
424
|
+
result = (_b.sent()).data;
|
|
425
|
+
if (!result || isErrorResponse(result))
|
|
426
|
+
throw new Error('failed to query unspent transactions');
|
|
427
|
+
return [2 /*return*/, result];
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
});
|
|
431
|
+
};
|
|
432
|
+
exports.getUnspentTransactions = getUnspentTransactions;
|
|
433
|
+
/**
|
|
434
|
+
* Broadcast transaction.
|
|
435
|
+
*
|
|
436
|
+
* @see https://app.swaggerhub.com/apis/eligecode/blockchain-api/0.0.1-oas3#/blockchain/sendTransaction
|
|
437
|
+
*
|
|
438
|
+
* Note: Because of an Haskoin issue (@see https://github.com/haskoin/haskoin-store/issues/25),
|
|
439
|
+
* we need to broadcast same tx several times in case of `500` errors
|
|
440
|
+
* @see https://github.com/xchainjs/xchainjs-lib/issues/492
|
|
441
|
+
*
|
|
442
|
+
* @param {BroadcastTxParams} params
|
|
443
|
+
* @returns {TxHash} Transaction hash.
|
|
444
|
+
*/
|
|
445
|
+
var broadcastTx = function (_a) {
|
|
446
|
+
var txHex = _a.txHex, haskoinUrl = _a.haskoinUrl, haskoinNetwork = _a.haskoinNetwork;
|
|
447
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
448
|
+
var MAX_RETRIES, retries, axiosInstance, url, response, txid, error_1;
|
|
449
|
+
var _b;
|
|
450
|
+
return __generator(this, function (_c) {
|
|
451
|
+
switch (_c.label) {
|
|
452
|
+
case 0:
|
|
453
|
+
MAX_RETRIES = 5;
|
|
454
|
+
retries = 0;
|
|
455
|
+
axiosInstance = axios_1.default.create();
|
|
456
|
+
url = haskoinUrl + "/" + haskoinNetwork + "/transactions";
|
|
457
|
+
_c.label = 1;
|
|
458
|
+
case 1:
|
|
459
|
+
if (!(retries < MAX_RETRIES)) return [3 /*break*/, 9];
|
|
460
|
+
_c.label = 2;
|
|
461
|
+
case 2:
|
|
462
|
+
_c.trys.push([2, 4, , 8]);
|
|
463
|
+
return [4 /*yield*/, axiosInstance.post(url, txHex)];
|
|
464
|
+
case 3:
|
|
465
|
+
response = _c.sent();
|
|
466
|
+
txid = response.data.txid;
|
|
467
|
+
return [2 /*return*/, txid];
|
|
468
|
+
case 4:
|
|
469
|
+
error_1 = _c.sent();
|
|
470
|
+
if (!(((_b = error_1.response) === null || _b === void 0 ? void 0 : _b.status) === 500)) return [3 /*break*/, 6];
|
|
471
|
+
retries++;
|
|
472
|
+
return [4 /*yield*/, xchain_util_1.delay(200 * retries)];
|
|
473
|
+
case 5:
|
|
474
|
+
_c.sent();
|
|
475
|
+
return [3 /*break*/, 7];
|
|
476
|
+
case 6: return [2 /*return*/, Promise.reject(error_1)];
|
|
477
|
+
case 7: return [3 /*break*/, 8];
|
|
478
|
+
case 8: return [3 /*break*/, 1];
|
|
479
|
+
case 9: return [2 /*return*/, Promise.reject(new Error('Max retries exceeded'))];
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
};
|
|
484
|
+
exports.broadcastTx = broadcastTx;
|
|
485
|
+
//# sourceMappingURL=haskoin-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"haskoin-api.js","sourceRoot":"","sources":["../../../src/providers/haskoin/haskoin-api.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;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;oBAChC,OAAO,EAAE,CAAA;oBACT,qBAAM,mBAAK,CAAC,GAAG,GAAG,OAAO,CAAC,EAAA;;oBAA1B,SAA0B,CAAA;;wBAE1B,sBAAO,OAAO,CAAC,MAAM,CAAC,OAAK,CAAC,EAAA;;;wBAKlC,sBAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC,EAAA;;;;CACzD,CAAA;AAhCY,QAAA,WAAW,eAgCvB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Balance, Tx, TxHash, TxHistoryParams, TxsPage, UTXO, UtxoOnlineDataProvider } from '@xchainjs/xchain-client';
|
|
2
|
+
import { Address, Asset, Chain } from '@xchainjs/xchain-util';
|
|
3
|
+
import { HaskoinNetwork } from './haskoin-api-types';
|
|
4
|
+
export declare class HaskoinProvider implements UtxoOnlineDataProvider {
|
|
5
|
+
private baseUrl;
|
|
6
|
+
private chain;
|
|
7
|
+
private asset;
|
|
8
|
+
private assetDecimals;
|
|
9
|
+
private haskoinNetwork;
|
|
10
|
+
constructor(baseUrl: string, chain: Chain, asset: Asset, assetDecimals: number, haskoinNetwork: HaskoinNetwork);
|
|
11
|
+
broadcastTx(txHex: string): Promise<TxHash>;
|
|
12
|
+
getConfirmedUnspentTxs(address: string): Promise<UTXO[]>;
|
|
13
|
+
getUnspentTxs(address: string): Promise<UTXO[]>;
|
|
14
|
+
getBalance(address: Address, assets?: Asset[], confirmedOnly?: boolean): Promise<Balance[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Get transaction history of a given address with pagination options.
|
|
17
|
+
* By default it will return the transaction history of the current wallet.
|
|
18
|
+
*
|
|
19
|
+
* @param {TxHistoryParams} params The options to get transaction history. (optional)
|
|
20
|
+
* @returns {TxsPage} The transaction history.
|
|
21
|
+
*/
|
|
22
|
+
getTransactions(params?: TxHistoryParams): Promise<TxsPage>;
|
|
23
|
+
private mapTransactionToTx;
|
|
24
|
+
/**
|
|
25
|
+
* Get the transaction details of a given transaction id.
|
|
26
|
+
*
|
|
27
|
+
* @param {string} txId The transaction id.
|
|
28
|
+
* @returns {Tx} The transaction details of the given transaction id.
|
|
29
|
+
*/
|
|
30
|
+
getTransactionData(txId: string): Promise<Tx>;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @param utxos
|
|
34
|
+
* @returns utxo array
|
|
35
|
+
*/
|
|
36
|
+
private mapUTXOs;
|
|
37
|
+
}
|