@@ -597,30 +597,29 @@ export class EnclavedExpressClient {
597597 }
598598 }
599599
600- /**
601- * Create custom MPCv2 Round 1 signing function for enclaved express client
602- */
603- export function signMPCv2Round1 (
604- enclavedExpressClient : EnclavedExpressClient ,
605- source : 'user' | 'backup' ,
606- pub : string ,
607- ) : ( params : SignMpcV2Round1Params ) => Promise < SignMpcV2Round1Response > {
608- return async function ( params ) : Promise < SignMpcV2Round1Response > {
609- if ( ! enclavedExpressClient [ 'coin' ] ) {
600+ /**
601+ * Sign MPCv2 Round 1
602+ */
603+ async signMPCv2Round1 (
604+ source : 'user' | 'backup' ,
605+ pub : string ,
606+ params : SignMpcV2Round1Params ,
607+ ) : Promise < SignMpcV2Round1Response > {
608+ if ( ! this [ 'coin' ] ) {
610609 throw new Error ( 'Coin must be specified to sign an MPCv2 Round 1' ) ;
611610 }
612611
613612 try {
614- let request = enclavedExpressClient [ 'apiClient' ] [ 'v1.mpc.sign' ] . post ( {
615- coin : enclavedExpressClient [ 'coin' ] ,
613+ let request = this [ 'apiClient' ] [ 'v1.mpc.sign' ] . post ( {
614+ coin : this [ 'coin' ] ,
616615 shareType : 'mpcv2round1' ,
617616 ...params ,
618617 source,
619618 pub,
620619 } ) ;
621620
622- if ( enclavedExpressClient [ 'tlsMode' ] === TlsMode . MTLS ) {
623- request = request . agent ( enclavedExpressClient [ 'createHttpsAgent' ] ( ) ) ;
621+ if ( this [ 'tlsMode' ] === TlsMode . MTLS ) {
622+ request = request . agent ( this [ 'createHttpsAgent' ] ( ) ) ;
624623 }
625624 const response = await request . decodeExpecting ( 200 ) ;
626625 return response . body ;
@@ -629,33 +628,31 @@ export function signMPCv2Round1(
629628 debugLogger ( 'Failed to sign mpcv2 round 1: %s' , err . message ) ;
630629 throw err ;
631630 }
632- } ;
633- }
631+ }
634632
635- /**
636- * Create custom MPCv2 Round 2 signing function for enclaved express client
637- */
638- export function signMPCv2Round2 (
639- enclavedExpressClient : EnclavedExpressClient ,
640- source : 'user' | 'backup' ,
641- pub : string ,
642- ) : ( params : SignMpcV2Round2Params ) => Promise < SignMpcV2Round2Response > {
643- return async function ( params ) : Promise < SignMpcV2Round2Response > {
644- if ( ! enclavedExpressClient [ 'coin' ] ) {
633+ /**
634+ * Sign MPCv2 Round 2
635+ */
636+ async signMPCv2Round2 (
637+ source : 'user' | 'backup' ,
638+ pub : string ,
639+ params : SignMpcV2Round2Params ,
640+ ) : Promise < SignMpcV2Round2Response > {
641+ if ( ! this [ 'coin' ] ) {
645642 throw new Error ( 'Coin must be specified to sign an MPCv2 Round 2' ) ;
646643 }
647644
648645 try {
649- let request = enclavedExpressClient [ 'apiClient' ] [ 'v1.mpc.sign' ] . post ( {
650- coin : enclavedExpressClient [ 'coin' ] ,
646+ let request = this [ 'apiClient' ] [ 'v1.mpc.sign' ] . post ( {
647+ coin : this [ 'coin' ] ,
651648 shareType : 'mpcv2round2' ,
652649 ...params ,
653650 source,
654651 pub,
655652 } ) ;
656653
657- if ( enclavedExpressClient [ 'tlsMode' ] === TlsMode . MTLS ) {
658- request = request . agent ( enclavedExpressClient [ 'createHttpsAgent' ] ( ) ) ;
654+ if ( this [ 'tlsMode' ] === TlsMode . MTLS ) {
655+ request = request . agent ( this [ 'createHttpsAgent' ] ( ) ) ;
659656 }
660657 const response = await request . decodeExpecting ( 200 ) ;
661658 return response . body ;
@@ -664,33 +661,31 @@ export function signMPCv2Round2(
664661 debugLogger ( 'Failed to sign mpcv2 round 2: %s' , err . message ) ;
665662 throw err ;
666663 }
667- } ;
668- }
664+ }
669665
670- /**
671- * Create custom MPCv2 Round 3 signing function for enclaved express client
672- */
673- export function signMPCv2Round3 (
674- enclavedExpressClient : EnclavedExpressClient ,
675- source : 'user' | 'backup' ,
676- pub : string ,
677- ) : ( params : SignMpcV2Round3Params ) => Promise < SignMpcV2Round3Response > {
678- return async function ( params ) : Promise < SignMpcV2Round3Response > {
679- if ( ! enclavedExpressClient [ 'coin' ] ) {
666+ /**
667+ * Sign MPCv2 Round 3
668+ */
669+ async signMPCv2Round3 (
670+ source : 'user' | 'backup' ,
671+ pub : string ,
672+ params : SignMpcV2Round3Params ,
673+ ) : Promise < SignMpcV2Round3Response > {
674+ if ( ! this [ 'coin' ] ) {
680675 throw new Error ( 'Coin must be specified to sign an MPCv2 Round 3' ) ;
681676 }
682677
683678 try {
684- let request = enclavedExpressClient [ 'apiClient' ] [ 'v1.mpc.sign' ] . post ( {
685- coin : enclavedExpressClient [ 'coin' ] ,
679+ let request = this [ 'apiClient' ] [ 'v1.mpc.sign' ] . post ( {
680+ coin : this [ 'coin' ] ,
686681 shareType : 'mpcv2round3' ,
687682 ...params ,
688683 source,
689684 pub,
690685 } ) ;
691686
692- if ( enclavedExpressClient [ 'tlsMode' ] === TlsMode . MTLS ) {
693- request = request . agent ( enclavedExpressClient [ 'createHttpsAgent' ] ( ) ) ;
687+ if ( this [ 'tlsMode' ] === TlsMode . MTLS ) {
688+ request = request . agent ( this [ 'createHttpsAgent' ] ( ) ) ;
694689 }
695690 const response = await request . decodeExpecting ( 200 ) ;
696691 return response . body ;
@@ -699,7 +694,7 @@ export function signMPCv2Round3(
699694 debugLogger ( 'Failed to sign mpcv2 round 3: %s' , err . message ) ;
700695 throw err ;
701696 }
702- } ;
697+ }
703698}
704699
705700/**
0 commit comments