Skip to content

Commit 1e71b44

Browse files
feat(mbe): fix linting
1 parent b5130b6 commit 1e71b44

File tree

2 files changed

+32
-41
lines changed

2 files changed

+32
-41
lines changed

src/__tests__/api/master/consolidateMPC.test.ts

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,10 @@ describe('POST /api/:coin/wallet/:walletId/consolidate (EDDSA MPC)', () => {
5656
});
5757

5858
// Mock keychain get request
59-
const keychainGetNock = nock(bitgoApiUrl)
60-
.get(`/api/v2/${coin}/key/user-key-id`)
61-
.reply(200, {
62-
id: 'user-key-id',
63-
commonKeychain: 'pubkey',
64-
});
59+
const keychainGetNock = nock(bitgoApiUrl).get(`/api/v2/${coin}/key/user-key-id`).reply(200, {
60+
id: 'user-key-id',
61+
commonKeychain: 'pubkey',
62+
});
6563

6664
// Mock sendAccountConsolidations on Wallet prototype
6765
const sendConsolidationsStub = sinon
@@ -80,8 +78,10 @@ describe('POST /api/:coin/wallet/:walletId/consolidate (EDDSA MPC)', () => {
8078
const mockCommitmentFn = sinon.stub().resolves({ userToBitgoCommitment: 'commitment' });
8179
const mockRShareFn = sinon.stub().resolves({ rShare: 'rshare' });
8280
const mockGShareFn = sinon.stub().resolves({ gShare: 'gshare' });
83-
84-
const commitmentSpy = sinon.stub(eddsa, 'createCustomCommitmentGenerator').returns(mockCommitmentFn);
81+
82+
const commitmentSpy = sinon
83+
.stub(eddsa, 'createCustomCommitmentGenerator')
84+
.returns(mockCommitmentFn);
8585
const rshareSpy = sinon.stub(eddsa, 'createCustomRShareGenerator').returns(mockRShareFn);
8686
const gshareSpy = sinon.stub(eddsa, 'createCustomGShareGenerator').returns(mockGShareFn);
8787

@@ -119,26 +119,22 @@ describe('POST /api/:coin/wallet/:walletId/consolidate (EDDSA MPC)', () => {
119119
});
120120

121121
// Mock keychain get request
122-
const keychainGetNock = nock(bitgoApiUrl)
123-
.get(`/api/v2/${coin}/key/user-key-id`)
124-
.reply(200, {
125-
id: 'user-key-id',
126-
commonKeychain: 'pubkey',
127-
});
122+
const keychainGetNock = nock(bitgoApiUrl).get(`/api/v2/${coin}/key/user-key-id`).reply(200, {
123+
id: 'user-key-id',
124+
commonKeychain: 'pubkey',
125+
});
128126

129127
// Mock partial failure response
130-
sinon
131-
.stub(Wallet.prototype, 'sendAccountConsolidations')
132-
.resolves({
133-
success: [{ txid: 'success-txid', status: 'signed' }],
134-
failure: [{ error: 'Insufficient funds', address: '0xfailed' }],
135-
});
128+
sinon.stub(Wallet.prototype, 'sendAccountConsolidations').resolves({
129+
success: [{ txid: 'success-txid', status: 'signed' }],
130+
failure: [{ error: 'Insufficient funds', address: '0xfailed' }],
131+
});
136132

137133
// Mock EDDSA hooks
138134
const mockCommitmentFn = sinon.stub().resolves({ userToBitgoCommitment: 'commitment' });
139135
const mockRShareFn = sinon.stub().resolves({ rShare: 'rshare' });
140136
const mockGShareFn = sinon.stub().resolves({ gShare: 'gshare' });
141-
137+
142138
sinon.stub(eddsa, 'createCustomCommitmentGenerator').returns(mockCommitmentFn);
143139
sinon.stub(eddsa, 'createCustomRShareGenerator').returns(mockRShareFn);
144140
sinon.stub(eddsa, 'createCustomGShareGenerator').returns(mockGShareFn);
@@ -175,29 +171,25 @@ describe('POST /api/:coin/wallet/:walletId/consolidate (EDDSA MPC)', () => {
175171
});
176172

177173
// Mock keychain get request
178-
const keychainGetNock = nock(bitgoApiUrl)
179-
.get(`/api/v2/${coin}/key/user-key-id`)
180-
.reply(200, {
181-
id: 'user-key-id',
182-
commonKeychain: 'pubkey',
183-
});
174+
const keychainGetNock = nock(bitgoApiUrl).get(`/api/v2/${coin}/key/user-key-id`).reply(200, {
175+
id: 'user-key-id',
176+
commonKeychain: 'pubkey',
177+
});
184178

185179
// Mock total failure response
186-
sinon
187-
.stub(Wallet.prototype, 'sendAccountConsolidations')
188-
.resolves({
189-
success: [],
190-
failure: [
191-
{ error: 'Insufficient funds', address: '0xfailed1' },
192-
{ error: 'Invalid address', address: '0xfailed2' },
193-
],
194-
});
180+
sinon.stub(Wallet.prototype, 'sendAccountConsolidations').resolves({
181+
success: [],
182+
failure: [
183+
{ error: 'Insufficient funds', address: '0xfailed1' },
184+
{ error: 'Invalid address', address: '0xfailed2' },
185+
],
186+
});
195187

196188
// Mock EDDSA hooks
197189
const mockCommitmentFn = sinon.stub().resolves({ userToBitgoCommitment: 'commitment' });
198190
const mockRShareFn = sinon.stub().resolves({ rShare: 'rshare' });
199191
const mockGShareFn = sinon.stub().resolves({ gShare: 'gshare' });
200-
192+
201193
sinon.stub(eddsa, 'createCustomCommitmentGenerator').returns(mockCommitmentFn);
202194
sinon.stub(eddsa, 'createCustomRShareGenerator').returns(mockRShareFn);
203195
sinon.stub(eddsa, 'createCustomGShareGenerator').returns(mockGShareFn);
@@ -213,8 +205,8 @@ describe('POST /api/:coin/wallet/:walletId/consolidate (EDDSA MPC)', () => {
213205
response.status.should.equal(500);
214206
response.body.should.have.property('error');
215207
response.body.should.have.property('details').which.match(/All consolidations failed/);
216-
208+
217209
walletGetNock.done();
218210
keychainGetNock.done();
219211
});
220-
});
212+
});

src/api/master/handlers/handleConsolidate.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ export async function handleConsolidate(
7171
params.source,
7272
signingKeychain.commonKeychain!,
7373
);
74-
}
75-
else if (baseCoin.getMPCAlgorithm() === MPCType.ECDSA) {
74+
} else if (baseCoin.getMPCAlgorithm() === MPCType.ECDSA) {
7675
throw new Error('ECDSA MPC consolidations not yet implemented');
7776
}
7877
} else {

0 commit comments

Comments
 (0)