Skip to content
Open
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 @@ -935,11 +935,11 @@ async function handleV2SendOne(req: express.Request) {
* handle send many
* @param req
*/
async function handleV2SendMany(req: express.Request) {
async function handleV2SendMany(req: ExpressApiRouteRequest<'express.v2.wallet.sendmany', 'post'>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this works, we lose the type saftey of api-ts when using things like createTSSSendParams and createSendParams. Can we have a follow up to fix these?

As long as we have those two utilities, the codec and the actual request body we are acting on won't be aligned.

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;
try {
Expand Down Expand Up @@ -1639,7 +1639,7 @@ export function setupAPIRoutes(app: express.Application, config: Config): void {

// send transaction
app.post('/api/v2/:coin/wallet/:id/sendcoins', parseBody, prepareBitGo(config), promiseWrapper(handleV2SendOne));
app.post('/api/v2/:coin/wallet/:id/sendmany', parseBody, prepareBitGo(config), promiseWrapper(handleV2SendMany));
router.post('express.v2.wallet.sendmany', [prepareBitGo(config), typedPromiseWrapper(handleV2SendMany)]);
app.post(
'/api/v2/:coin/wallet/:id/prebuildAndSignTransaction',
parseBody,
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 @@ -34,6 +34,7 @@ import { PostWalletTxSignTSS } from './v2/walletTxSignTSS';
import { PostShareWallet } from './v2/shareWallet';
import { PutExpressWalletUpdate } from './v2/expressWalletUpdate';
import { PostFanoutUnspents } from './v2/fanoutUnspents';
import { PostSendMany } from './v2/sendmany';
import { PostConsolidateUnspents } from './v2/consolidateunspents';
import { PostCoinSign } from './v2/coinSign';

Expand Down Expand Up @@ -157,6 +158,12 @@ export const ExpressV2WalletCreateAddressApiSpec = apiSpec({
},
});

export const ExpressV2WalletSendManyApiSpec = apiSpec({
'express.v2.wallet.sendmany': {
post: PostSendMany,
},
});

export const ExpressKeychainLocalApiSpec = apiSpec({
'express.keychain.local': {
post: PostKeychainLocal,
Expand Down Expand Up @@ -252,6 +259,7 @@ export type ExpressApi = typeof ExpressPingApiSpec &
typeof ExpressLightningGetStateApiSpec &
typeof ExpressLightningInitWalletApiSpec &
typeof ExpressLightningUnlockWalletApiSpec &
typeof ExpressV2WalletSendManyApiSpec &
typeof ExpressOfcSignPayloadApiSpec &
typeof ExpressWalletRecoverTokenApiSpec &
typeof ExpressCoinSigningApiSpec &
Expand Down Expand Up @@ -282,6 +290,7 @@ export const ExpressApi: ExpressApi = {
...ExpressLightningGetStateApiSpec,
...ExpressLightningInitWalletApiSpec,
...ExpressLightningUnlockWalletApiSpec,
...ExpressV2WalletSendManyApiSpec,
...ExpressOfcSignPayloadApiSpec,
...ExpressWalletRecoverTokenApiSpec,
...ExpressCoinSigningApiSpec,
Expand Down
Loading