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
8 changes: 4 additions & 4 deletions modules/express/src/clientRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -911,11 +911,11 @@ function createTSSSendParams(req: express.Request, wallet: Wallet) {
* handle send one
* @param req
*/
async function handleV2SendOne(req: express.Request) {
async function handleV2SendOne(req: ExpressApiRouteRequest<'express.v2.wallet.sendcoins', 'post'>) {
const bitgo = req.bitgo;
const coin = bitgo.coin(req.params.coin);
const coin = bitgo.coin(req.decoded.coin);
const reqId = new RequestTracer();
const wallet = await coin.wallets().get({ id: req.params.id, reqId });
const wallet = await coin.wallets().get({ id: req.decoded.id, reqId });
req.body.reqId = reqId;

let result;
Expand Down Expand Up @@ -1640,7 +1640,7 @@ export function setupAPIRoutes(app: express.Application, config: Config): void {
router.post('express.v2.wallet.recovertoken', [prepareBitGo(config), typedPromiseWrapper(handleV2RecoverToken)]);

// send transaction
app.post('/api/v2/:coin/wallet/:id/sendcoins', parseBody, prepareBitGo(config), promiseWrapper(handleV2SendOne));
router.post('express.v2.wallet.sendcoins', [prepareBitGo(config), typedPromiseWrapper(handleV2SendOne)]);
router.post('express.v2.wallet.sendmany', [prepareBitGo(config), typedPromiseWrapper(handleV2SendMany)]);
router.post('express.v2.wallet.prebuildandsigntransaction', [
prepareBitGo(config),
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 @@ -38,6 +38,7 @@ import { PostSendMany } from './v2/sendmany';
import { PostConsolidateUnspents } from './v2/consolidateunspents';
import { PostPrebuildAndSignTransaction } from './v2/prebuildAndSignTransaction';
import { PostCoinSign } from './v2/coinSign';
import { PostSendCoins } from './v2/sendCoins';

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

export const ExpressV2WalletSendCoinsApiSpec = apiSpec({
'express.v2.wallet.sendcoins': {
post: PostSendCoins,
},
});

export const ExpressKeychainLocalApiSpec = apiSpec({
'express.keychain.local': {
post: PostKeychainLocal,
Expand Down Expand Up @@ -264,6 +271,7 @@ export type ExpressApi = typeof ExpressPingApiSpec &
typeof ExpressLightningInitWalletApiSpec &
typeof ExpressLightningUnlockWalletApiSpec &
typeof ExpressV2WalletSendManyApiSpec &
typeof ExpressV2WalletSendCoinsApiSpec &
typeof ExpressOfcSignPayloadApiSpec &
typeof ExpressWalletRecoverTokenApiSpec &
typeof ExpressCoinSigningApiSpec &
Expand Down Expand Up @@ -295,6 +303,7 @@ export const ExpressApi: ExpressApi = {
...ExpressLightningInitWalletApiSpec,
...ExpressLightningUnlockWalletApiSpec,
...ExpressV2WalletSendManyApiSpec,
...ExpressV2WalletSendCoinsApiSpec,
...ExpressOfcSignPayloadApiSpec,
...ExpressWalletRecoverTokenApiSpec,
...ExpressCoinSigningApiSpec,
Expand Down
Loading