Skip to content

Commit 4753b91

Browse files
committed
refactor: reverting walletId back to id
TICKET: WP-5418
1 parent 2724ac2 commit 4753b91

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

modules/express/src/clientRoutes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ export async function handleV2GenerateWallet(req: express.Request) {
663663
export async function handleV2CreateAddress(req: ExpressApiRouteRequest<'express.v2.wallet.createAddress', 'post'>) {
664664
const bitgo = req.bitgo;
665665
const coin = bitgo.coin(req.decoded.coin);
666-
const wallet = await coin.wallets().get({ id: req.decoded.walletId });
666+
const wallet = await coin.wallets().get({ id: req.decoded.id });
667667
return wallet.createAddress(req.decoded);
668668
}
669669

modules/express/src/typedRoutes/api/v2/createAddress.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const CreateAddressParams = {
1010
/** Coin ticker / chain identifier */
1111
coin: t.string,
1212
/** The ID of the wallet. */
13-
walletId: t.string,
13+
id: t.string,
1414
} as const;
1515

1616
/**
@@ -62,6 +62,7 @@ export const CreateAddressResponse = {
6262
/**
6363
* Create address for a wallet
6464
*
65+
* @tag express
6566
* @operationId express.v2.wallet.createAddress
6667
*/
6768
export const PostCreateAddress = httpRoute({

modules/express/test/unit/clientRoutes/createAddress.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ describe('Create Address', () => {
3131
bitgo: bitgoStub,
3232
params: {
3333
coin: 'tbtc',
34-
walletId: '23423423423423',
34+
id: '23423423423423',
3535
},
3636
query: {},
3737
body: {
3838
chain: 0,
3939
},
4040
decoded: {
4141
coin: 'tbtc',
42-
walletId: '23423423423423',
42+
id: '23423423423423',
4343
chain: 0,
4444
},
4545
} as unknown as ExpressApiRouteRequest<'express.v2.wallet.createAddress', 'post'>;

modules/express/test/unit/typedRoutes/decode.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,16 +193,16 @@ describe('io-ts decode tests', function () {
193193
});
194194

195195
it('express.v2.wallet.createAddress params', function () {
196-
// missing walletId
196+
// missing id
197197
assert.throws(() => assertDecode(t.type(CreateAddressParams), { coin: 'btc' }));
198198
// coin must be string
199199
assert.throws(() =>
200-
assertDecode(t.type(CreateAddressParams), { coin: 123, walletId: '59cd72485007a239fb00282ed480da1f' })
200+
assertDecode(t.type(CreateAddressParams), { coin: 123, id: '59cd72485007a239fb00282ed480da1f' })
201201
);
202-
// walletId must be string
203-
assert.throws(() => assertDecode(t.type(CreateAddressParams), { coin: 'btc', walletId: 123 }));
202+
// id must be string
203+
assert.throws(() => assertDecode(t.type(CreateAddressParams), { coin: 'btc', id: 123 }));
204204
// valid params
205-
assertDecode(t.type(CreateAddressParams), { coin: 'btc', walletId: '59cd72485007a239fb00282ed480da1f' });
205+
assertDecode(t.type(CreateAddressParams), { coin: 'btc', id: '59cd72485007a239fb00282ed480da1f' });
206206
// invalid body
207207
assert.throws(() => assertDecode(t.type(CreateAddressBody), { chain: '1' }));
208208
assert.throws(() => assertDecode(t.type(CreateAddressBody), { format: 'invalid' }));

0 commit comments

Comments
 (0)