File tree Expand file tree Collapse file tree 3 files changed +6
-16
lines changed
Expand file tree Collapse file tree 3 files changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -22,18 +22,6 @@ export async function handleAccelerate(
2222 KeyIndices,
2323 } ) ;
2424
25- if ( ! wallet ) {
26- throw new Error ( `Wallet ${ walletId } not found` ) ;
27- }
28-
29- if ( ! signingKeychain || ! signingKeychain . pub ) {
30- throw new Error ( `Signing keychain for ${ params . source } not found` ) ;
31- }
32-
33- if ( params . pubkey && params . pubkey !== signingKeychain . pub ) {
34- throw new Error ( `Pub provided does not match the keychain on wallet for ${ params . source } ` ) ;
35- }
36-
3725 try {
3826 // Create custom signing function that delegates to EBE
3927 const customSigningFunction = makeCustomSigningFunction ( {
Original file line number Diff line number Diff line change @@ -32,10 +32,6 @@ export async function handleConsolidate(
3232 throw new Error ( 'consolidateAddresses must be an array of addresses' ) ;
3333 }
3434
35- if ( params . pubkey && params . pubkey !== signingKeychain . pub ) {
36- throw new Error ( `Pub provided does not match the keychain on wallet for ${ params . source } ` ) ;
37- }
38-
3935 try {
4036 // Create custom signing function that delegates to EBE
4137 const customSigningFunction = makeCustomSigningFunction ( {
Original file line number Diff line number Diff line change @@ -84,20 +84,26 @@ export async function getWalletAndSigningKeychain({
8484 KeyIndices : { USER : number ; BACKUP : number ; BITGO : number } ;
8585} ) {
8686 const baseCoin = bitgo . coin ( coin ) ;
87+
8788 const wallet = await baseCoin . wallets ( ) . get ( { id : walletId , reqId } ) ;
89+
8890 if ( ! wallet ) {
8991 throw new Error ( `Wallet ${ walletId } not found` ) ;
9092 }
93+
9194 const keyIdIndex = params . source === 'user' ? KeyIndices . USER : KeyIndices . BACKUP ;
9295 const signingKeychain = await baseCoin . keychains ( ) . get ( {
9396 id : wallet . keyIds ( ) [ keyIdIndex ] ,
9497 } ) ;
98+
9599 if ( ! signingKeychain || ! signingKeychain . pub ) {
96100 throw new Error ( `Signing keychain for ${ params . source } not found` ) ;
97101 }
102+
98103 if ( params . pubkey && params . pubkey !== signingKeychain . pub ) {
99104 throw new Error ( `Pub provided does not match the keychain on wallet for ${ params . source } ` ) ;
100105 }
106+
101107 return { baseCoin, wallet, signingKeychain } ;
102108}
103109
You can’t perform that action at this time.
0 commit comments