Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions modules/express/src/clientRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -854,10 +854,10 @@ async function handleV2Sweep(req: ExpressApiRouteRequest<'express.v2.wallet.swee
* handle CPFP accelerate transaction creation
* @param req
*/
async function handleV2AccelerateTransaction(req: express.Request) {
async function handleV2AccelerateTransaction(req: ExpressApiRouteRequest<'express.v2.wallet.accelerateTx', 'post'>) {
const bitgo = req.bitgo;
const coin = bitgo.coin(req.params.coin);
const wallet = await coin.wallets().get({ id: req.params.id });
const coin = bitgo.coin(req.decoded.coin);
const wallet = await coin.wallets().get({ id: req.decoded.id });
return wallet.accelerateTransaction(createSendParams(req));
}

Expand Down Expand Up @@ -1682,12 +1682,10 @@ export function setupAPIRoutes(app: express.Application, config: Config): void {
router.post('express.v2.wallet.sweep', [prepareBitGo(config), typedPromiseWrapper(handleV2Sweep)]);

// CPFP
app.post(
'/api/v2/:coin/wallet/:id/acceleratetx',
parseBody,
router.post('express.v2.wallet.accelerateTx', [
prepareBitGo(config),
promiseWrapper(handleV2AccelerateTransaction)
);
typedPromiseWrapper(handleV2AccelerateTransaction),
]);

// account-based
router.post('express.v2.wallet.consolidateaccount', [
Expand Down
9 changes: 9 additions & 0 deletions modules/express/src/typedRoutes/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import { PostConsolidateAccount } from './v2/consolidateAccount';
import { PostCanonicalAddress } from './v2/canonicalAddress';
import { PostWalletEnableTokens } from './v2/walletEnableTokens';
import { PostWalletSweep } from './v2/walletSweep';
import { PostWalletAccelerateTx } from './v2/walletAccelerateTx';
import { PostIsWalletAddress } from './v2/isWalletAddress';

// Too large types can cause the following error
Expand Down Expand Up @@ -311,6 +312,12 @@ export const ExpressV2WalletSweepApiSpec = apiSpec({
},
});

export const ExpressV2WalletAccelerateTxApiSpec = apiSpec({
'express.v2.wallet.accelerateTx': {
post: PostWalletAccelerateTx,
},
});

export type ExpressApi = typeof ExpressPingApiSpec &
typeof ExpressPingExpressApiSpec &
typeof ExpressLoginApiSpec &
Expand Down Expand Up @@ -348,6 +355,7 @@ export type ExpressApi = typeof ExpressPingApiSpec &
typeof ExpressWalletSigningApiSpec &
typeof ExpressV2CanonicalAddressApiSpec &
typeof ExpressV2WalletSweepApiSpec &
typeof ExpressV2WalletAccelerateTxApiSpec &
typeof ExpressWalletManagementApiSpec;

export const ExpressApi: ExpressApi = {
Expand Down Expand Up @@ -388,6 +396,7 @@ export const ExpressApi: ExpressApi = {
...ExpressWalletSigningApiSpec,
...ExpressV2CanonicalAddressApiSpec,
...ExpressV2WalletSweepApiSpec,
...ExpressV2WalletAccelerateTxApiSpec,
...ExpressWalletManagementApiSpec,
};

Expand Down
Loading