11import * as t from 'io-ts' ;
22import { httpRoute , httpRequest , optional } from '@api-ts/io-ts-http' ;
33import { BitgoExpressError } from '../../schemas/error' ;
4+ import { Recipient } from './coinSignTx' ;
45
56/**
67 * Path parameters for recovering tokens from a wallet
@@ -14,12 +15,14 @@ export const RecoverTokenParams = {
1415
1516/**
1617 * Request body for recovering tokens from a wallet
18+ *
19+ * Note: When broadcast=false (default), either walletPassphrase or prv must be provided for signing.
1720 */
1821export const RecoverTokenBody = {
19- /** The contract address of the unsupported token to recover */
20- tokenContractAddress : optional ( t . string ) ,
21- /** The destination address where recovered tokens should be sent */
22- recipient : optional ( t . string ) ,
22+ /** The contract address of the unsupported token to recover (REQUIRED) */
23+ tokenContractAddress : t . string ,
24+ /** The destination address where recovered tokens should be sent (REQUIRED) */
25+ recipient : t . string ,
2326 /** Whether to automatically broadcast the half-signed transaction to BitGo for cosigning and broadcasting */
2427 broadcast : optional ( t . boolean ) ,
2528 /** The wallet passphrase used to decrypt the user key */
@@ -34,8 +37,8 @@ export const RecoverTokenBody = {
3437export const RecoverTokenResponse = t . type ( {
3538 halfSigned : t . type ( {
3639 /** Recipient information for the recovery transaction */
37- recipient : t . unknown ,
38- /** Expiration time for the transaction */
40+ recipient : Recipient ,
41+ /** Expiration time for the transaction (Unix timestamp in seconds) */
3942 expireTime : t . number ,
4043 /** Contract sequence ID */
4144 contractSequenceId : t . number ,
@@ -61,6 +64,15 @@ export const RecoverTokenResponse = t.type({
6164 * The transaction can be manually submitted to BitGo for cosigning, or automatically broadcast
6265 * by setting the 'broadcast' parameter to true.
6366 *
67+ * Requirements:
68+ * - tokenContractAddress (REQUIRED): The ERC-20 token contract address
69+ * - recipient (REQUIRED): The destination address for recovered tokens
70+ * - walletPassphrase or prv (REQUIRED when broadcast=false): For signing the transaction
71+ *
72+ * Behavior:
73+ * - When broadcast=false (default): Returns a half-signed transaction for manual submission
74+ * - When broadcast=true: Automatically sends the transaction to BitGo for cosigning and broadcasting
75+ *
6476 * Note: This endpoint is only supported for ETH family wallets.
6577 *
6678 * @tag express
0 commit comments