1- import superagent from 'superagent' ;
2- import https from 'https' ;
3- import debug from 'debug' ;
4- import { MasterExpressConfig } from '../types' ;
5- import { TlsMode } from '../types' ;
61import { SignedTransaction , TransactionPrebuild } from '@bitgo/sdk-core' ;
2+ import debug from 'debug' ;
3+ import https from 'https' ;
4+ import superagent from 'superagent' ;
5+ import { MasterExpressConfig , TlsMode } from '../types' ;
76
87const debugLogger = debug ( 'bitgo:express:enclavedExpressClient' ) ;
98
@@ -29,6 +28,18 @@ interface SignMultisigOptions {
2928 pub : string ;
3029}
3130
31+ interface RecoveryMultisigOptions {
32+ userPub : string ;
33+ backupPub : string ;
34+ walletContractAddress : string ;
35+ recoveryDestinationAddress : string ;
36+ apiKey : string ;
37+ recoveryParams ?: {
38+ bitgoPub ?: string ;
39+ ignoreAddressTypes : string [ ] ;
40+ } ;
41+ }
42+
3243export class EnclavedExpressClient {
3344 private readonly baseUrl : string ;
3445 private readonly enclavedExpressCert : string ;
@@ -134,6 +145,27 @@ export class EnclavedExpressClient {
134145 throw err ;
135146 }
136147 }
148+
149+ /**
150+ * Recovery a multisig transaction
151+ */
152+ async recoveryMultisig ( params : RecoveryMultisigOptions ) : Promise < SignedTransaction > {
153+ if ( ! this . coin ) {
154+ throw new Error ( 'Coin must be specified to recovery a multisig' ) ;
155+ }
156+
157+ try {
158+ const res = await this . configureRequest (
159+ superagent . post ( `${ this . baseUrl } /api/${ this . coin } /multisig/recovery` ) . type ( 'json' ) ,
160+ ) . send ( params ) ;
161+
162+ return res . body ;
163+ } catch ( error ) {
164+ const err = error as Error ;
165+ debugLogger ( 'Failed to recover multisig: %s' , err . message ) ;
166+ throw err ;
167+ }
168+ }
137169}
138170
139171/**
0 commit comments