-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsolidateRoute.ts
More file actions
62 lines (57 loc) · 2.09 KB
/
consolidateRoute.ts
File metadata and controls
62 lines (57 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { httpRequest, HttpResponse, httpRoute, optional } from '@api-ts/io-ts-http';
import * as t from 'io-ts';
import { ErrorResponses } from '../../shared/errors';
export const ConsolidateRequest = {
/**
* The key to use for signing the transaction
*/
source: t.union([t.literal('user'), t.literal('backup')]),
/**
* Public key of the key used for signing multisig transactions
*/
pubkey: t.union([t.undefined, t.string]),
/**
* Optional: restrict the consolidation to the specified receive addresses. If not provided, will consolidate the
* funds from all receive addresses up to 500 addresses.
*/
consolidateAddresses: optional(t.array(t.string)),
/**
* For TSS wallets, this is the common keychain of the wallet
*/
commonKeychain: t.union([t.undefined, t.string]),
/**
* The Trasaction Request API version to use for MPC EdDSA Hot Wallets.
* Defaults based on the wallet type and asset curve.
*/
apiVersion: t.union([t.undefined, t.literal('full'), t.literal('lite')]),
};
export const ConsolidateResponse: HttpResponse = {
200: t.any,
...ErrorResponses,
};
/**
* Advanced Wallets - Consolidate Account
*
* Build, sign, and send a consolidation transaction, all in one call. For account-based assets, consolidating the balances in the receive addresses to the base address maximizes the spendable balance of a wallet.
*
* Retrieves the private key from key provider using the provided public key or common keychain, then signs and broadcasts the transaction.
*
* Use this endpoint only with advanced wallets. For other wallet types, use [Consolidate account (simple)](https://developers.bitgo.com/reference/expresswalletconsolidateaccount).
*
* @tag Advanced Wallets
* @operationId advancedwallet.consolidate
* @public
*/
export const ConsolidateRoute = httpRoute({
method: 'POST',
path: '/api/v1/{coin}/advancedwallet/{walletId}/consolidate',
request: httpRequest({
params: {
walletId: t.string,
coin: t.string,
},
body: ConsolidateRequest,
}),
response: ConsolidateResponse,
description: 'Consolidate addresses',
});