Route submitpackage calls to core on esplora backends
This commit is contained in:
parent
d1741a51c9
commit
735ed87b78
@ -48,6 +48,8 @@ class BitcoinRoutes {
|
|||||||
.post(config.MEMPOOL.API_URL_PREFIX + 'psbt/addparents', this.postPsbtCompletion)
|
.post(config.MEMPOOL.API_URL_PREFIX + 'psbt/addparents', this.postPsbtCompletion)
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'blocks-bulk/:from', this.getBlocksByBulk.bind(this))
|
.get(config.MEMPOOL.API_URL_PREFIX + 'blocks-bulk/:from', this.getBlocksByBulk.bind(this))
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'blocks-bulk/:from/:to', this.getBlocksByBulk.bind(this))
|
.get(config.MEMPOOL.API_URL_PREFIX + 'blocks-bulk/:from/:to', this.getBlocksByBulk.bind(this))
|
||||||
|
// Temporarily add txs/package endpoint for all backends until esplora supports it
|
||||||
|
.post(config.MEMPOOL.API_URL_PREFIX + 'txs/package', this.$submitPackage)
|
||||||
;
|
;
|
||||||
|
|
||||||
if (config.MEMPOOL.BACKEND !== 'esplora') {
|
if (config.MEMPOOL.BACKEND !== 'esplora') {
|
||||||
@ -58,7 +60,6 @@ class BitcoinRoutes {
|
|||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId', this.getTransaction)
|
.get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId', this.getTransaction)
|
||||||
.post(config.MEMPOOL.API_URL_PREFIX + 'tx', this.$postTransaction)
|
.post(config.MEMPOOL.API_URL_PREFIX + 'tx', this.$postTransaction)
|
||||||
.post(config.MEMPOOL.API_URL_PREFIX + 'txs/test', this.$testTransactions)
|
.post(config.MEMPOOL.API_URL_PREFIX + 'txs/test', this.$testTransactions)
|
||||||
.post(config.MEMPOOL.API_URL_PREFIX + 'txs/package', this.$submitPackage)
|
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId/hex', this.getRawTransaction)
|
.get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId/hex', this.getRawTransaction)
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId/status', this.getTransactionStatus)
|
.get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId/status', this.getTransactionStatus)
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId/outspends', this.getTransactionOutspends)
|
.get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId/outspends', this.getTransactionOutspends)
|
||||||
@ -799,8 +800,8 @@ class BitcoinRoutes {
|
|||||||
try {
|
try {
|
||||||
const rawTxs = Common.getTransactionsFromRequest(req);
|
const rawTxs = Common.getTransactionsFromRequest(req);
|
||||||
const maxfeerate = parseFloat(req.query.maxfeerate as string);
|
const maxfeerate = parseFloat(req.query.maxfeerate as string);
|
||||||
const maxburneamount = parseFloat(req.query.maxburneamount as string);
|
const maxburnamount = parseFloat(req.query.maxburnamount as string);
|
||||||
const result = await bitcoinApi.$submitPackage(rawTxs, maxfeerate, maxburneamount);
|
const result = await bitcoinClient.submitPackage(rawTxs, maxfeerate ?? undefined, maxburnamount ?? undefined);
|
||||||
res.send(result);
|
res.send(result);
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
handleError(req, res, 400, e.message && e.code ? 'submitpackage RPC error: ' + JSON.stringify({ code: e.code, message: e.message })
|
handleError(req, res, 400, e.message && e.code ? 'submitpackage RPC error: ' + JSON.stringify({ code: e.code, message: e.message })
|
||||||
|
@ -255,7 +255,7 @@ export class ApiService {
|
|||||||
if (maxburnamount) {
|
if (maxburnamount) {
|
||||||
queryParams.push(`maxburnamount=${maxburnamount}`);
|
queryParams.push(`maxburnamount=${maxburnamount}`);
|
||||||
}
|
}
|
||||||
return this.httpClient.post<SubmitPackageResult>(this.apiBaseUrl + this.apiBasePath + '/api/txs/package' + (queryParams.length > 0 ? `?${queryParams.join('&')}` : ''), rawTxs);
|
return this.httpClient.post<SubmitPackageResult>(this.apiBaseUrl + this.apiBasePath + '/api/v1/txs/package' + (queryParams.length > 0 ? `?${queryParams.join('&')}` : ''), rawTxs);
|
||||||
}
|
}
|
||||||
|
|
||||||
getTransactionStatus$(txid: string): Observable<any> {
|
getTransactionStatus$(txid: string): Observable<any> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user