Skip to content

Commit

Permalink
fix wallet response (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
oXtxNt9U authored Mar 15, 2024
1 parent 95c24dc commit 8f8264f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion packages/api-http/integration/routes/delegates.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ describe<{
];

for (const { id, result } of testCases) {
const { statusCode, data } = await request(`/delegates/${id}`, options);
const {
statusCode,
data: { data },
} = await request(`/delegates/${id}`, options);
assert.equal(statusCode, 200);
assert.equal(data, result);
}
Expand Down
5 changes: 4 additions & 1 deletion packages/api-http/integration/routes/wallets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ describe<{
];

for (const { id, result } of testCases) {
const { statusCode, data } = await request(`/wallets/${id}`, options);
const {
statusCode,
data: { data },
} = await request(`/wallets/${id}`, options);
assert.equal(statusCode, 200);
assert.equal(data, result);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/api-http/source/controllers/delegates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class DelegatesController extends Controller {
return Boom.notFound("Delegate not found");
}

return this.toResource(delegate, DelegateResource, request.params.transform);
return this.respondWithResource(delegate, DelegateResource, request.params.transform);
}

public async voters(request: Hapi.Request) {
Expand Down
2 changes: 1 addition & 1 deletion packages/api-http/source/controllers/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class WalletsController extends Controller {

const wallet = await this.getWallet(walletId);

return this.toResource(wallet, WalletResource, request.params.transform);
return this.respondWithResource(wallet, WalletResource, request.params.transform);
}

public async transactions(request: Hapi.Request) {
Expand Down

0 comments on commit 8f8264f

Please sign in to comment.