Skip to content

Commit 1c75ea2

Browse files
feat(mbe): fix linting
1 parent acf0ed6 commit 1c75ea2

5 files changed

Lines changed: 178 additions & 20 deletions

File tree

masterBitgoExpress.json

Lines changed: 172 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
}
115115
}
116116
},
117-
"/api/{coin}/wallet/{walletId}/sendMany": {
117+
"/api/{coin}/wallet/{walletId}/consolidateunspents": {
118118
"post": {
119119
"parameters": [
120120
{
@@ -143,20 +143,180 @@
143143
"pubkey": {
144144
"type": "string"
145145
},
146-
"type": {
146+
"source": {
147147
"type": "string",
148148
"enum": [
149-
"transfer",
150-
"acceleration",
151-
"accountSet",
152-
"enabletoken",
153-
"stakingLock",
154-
"stakingUnlock",
155-
"transfertoken",
156-
"trustline"
149+
"user",
150+
"backup"
151+
]
152+
},
153+
"walletPassphrase": {
154+
"type": "string"
155+
},
156+
"xprv": {
157+
"type": "string"
158+
},
159+
"feeRate": {
160+
"oneOf": [
161+
{
162+
"type": "string"
163+
},
164+
{
165+
"type": "number"
166+
}
167+
]
168+
},
169+
"maxFeeRate": {
170+
"oneOf": [
171+
{
172+
"type": "string"
173+
},
174+
{
175+
"type": "number"
176+
}
177+
]
178+
},
179+
"maxFeePercentage": {
180+
"type": "number"
181+
},
182+
"feeTxConfirmTarget": {
183+
"type": "number"
184+
},
185+
"bulk": {
186+
"type": "boolean"
187+
},
188+
"minValue": {
189+
"oneOf": [
190+
{
191+
"type": "string"
192+
},
193+
{
194+
"type": "number"
195+
}
196+
]
197+
},
198+
"maxValue": {
199+
"oneOf": [
200+
{
201+
"type": "string"
202+
},
203+
{
204+
"type": "number"
205+
}
157206
]
158207
},
159-
"commonKeychain": {
208+
"minHeight": {
209+
"type": "number"
210+
},
211+
"minConfirms": {
212+
"type": "number"
213+
},
214+
"enforceMinConfirmsForChange": {
215+
"type": "boolean"
216+
},
217+
"limit": {
218+
"type": "number"
219+
},
220+
"numUnspentsToMake": {
221+
"type": "number"
222+
},
223+
"targetAddress": {
224+
"type": "string"
225+
},
226+
"txFormat": {
227+
"type": "string",
228+
"enum": [
229+
"legacy",
230+
"psbt",
231+
"psbt-lite"
232+
]
233+
}
234+
},
235+
"required": [
236+
"pubkey",
237+
"source"
238+
]
239+
}
240+
}
241+
}
242+
},
243+
"responses": {
244+
"200": {
245+
"description": "OK",
246+
"content": {
247+
"application/json": {
248+
"schema": {}
249+
}
250+
}
251+
},
252+
"202": {
253+
"description": "Accepted",
254+
"content": {
255+
"application/json": {
256+
"schema": {}
257+
}
258+
}
259+
},
260+
"400": {
261+
"description": "Bad Request",
262+
"content": {
263+
"application/json": {
264+
"schema": {}
265+
}
266+
}
267+
},
268+
"500": {
269+
"description": "Internal Server Error",
270+
"content": {
271+
"application/json": {
272+
"schema": {
273+
"type": "object",
274+
"properties": {
275+
"error": {
276+
"type": "string"
277+
},
278+
"details": {
279+
"type": "string"
280+
}
281+
},
282+
"required": [
283+
"error",
284+
"details"
285+
]
286+
}
287+
}
288+
}
289+
}
290+
}
291+
}
292+
},
293+
"/api/{coin}/wallet/{walletId}/sendMany": {
294+
"post": {
295+
"parameters": [
296+
{
297+
"name": "walletId",
298+
"in": "path",
299+
"required": true,
300+
"schema": {
301+
"type": "string"
302+
}
303+
},
304+
{
305+
"name": "coin",
306+
"in": "path",
307+
"required": true,
308+
"schema": {
309+
"type": "string"
310+
}
311+
}
312+
],
313+
"requestBody": {
314+
"content": {
315+
"application/json": {
316+
"schema": {
317+
"type": "object",
318+
"properties": {
319+
"pubkey": {
160320
"type": "string"
161321
},
162322
"source": {
@@ -265,6 +425,7 @@
265425
}
266426
},
267427
"required": [
428+
"pubkey",
268429
"source",
269430
"recipients"
270431
]

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"test:watch": "mocha --require ts-node/register --watch 'src/**/__tests__/**/*.test.ts'",
1515
"test:coverage": "nyc mocha --require ts-node/register 'src/**/__tests__/**/*.test.ts'",
1616
"lint": "eslint --quiet .",
17+
"lint:fix": "eslint --quiet . --fix",
1718
"generate-test-ssl": "openssl req -x509 -newkey rsa:2048 -keyout test-ssl-key.pem -out test-ssl-cert.pem -days 365 -nodes -subj '/CN=localhost'",
1819
"generate:openapi:masterExpress": "npx @api-ts/openapi-generator --name @bitgo/master-bitgo-express ./src/api/master/routers/index.ts > masterBitgoExpress.json",
1920
"container:build": "podman build -t bitgo-onprem-express ."

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ describe('POST /api/:coin/wallet/:walletId/consolidateunspents', () => {
129129
const mockError = {
130130
error: 'Internal Server Error',
131131
name: 'ApiResponseError',
132-
details: 'There are too few unspents that meet the given parameters to consolidate (1 available).',
132+
details:
133+
'There are too few unspents that meet the given parameters to consolidate (1 available).',
133134
};
134135

135136
const consolidateUnspentsStub = sinon
@@ -188,4 +189,4 @@ describe('POST /api/:coin/wallet/:walletId/consolidateunspents', () => {
188189
walletGetNock.done();
189190
keychainGetNock.done();
190191
});
191-
});
192+
});

src/api/master/handlers/handleConsolidateUnspents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ export async function handleConsolidateUnspents(
5757
logger.error('Failed to consolidate unspents: %s', err.message);
5858
throw err;
5959
}
60-
}
60+
}

src/api/master/routers/masterApiSpec.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,7 @@ export const ConsolidateUnspentsRequest = {
168168
limit: t.union([t.undefined, t.number]),
169169
numUnspentsToMake: t.union([t.undefined, t.number]),
170170
targetAddress: t.union([t.undefined, t.string]),
171-
txFormat: t.union([
172-
t.undefined,
173-
t.literal('legacy'),
174-
t.literal('psbt'),
175-
t.literal('psbt-lite'),
176-
]),
171+
txFormat: t.union([t.undefined, t.literal('legacy'), t.literal('psbt'), t.literal('psbt-lite')]),
177172
};
178173

179174
const ConsolidateUnspentsResponse: HttpResponse = {

0 commit comments

Comments
 (0)