Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/api/enclaved/recoveryMultisigTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { MethodNotImplementedError } from 'bitgo';
import { EnclavedApiSpecRouteRequest } from '../../enclavedBitgoExpress/routers/enclavedApiSpec';
import logger from '../../logger';
import { isEthLikeCoin } from '../../shared/coinUtils';
import { HalfSignedEthLikeRecoveryTx } from '../../types/transaction';
import { retrieveKmsKey } from './utils';

export async function recoveryMultisigTransaction(
Expand Down Expand Up @@ -36,7 +37,7 @@ export async function recoveryMultisigTransaction(
walletContractAddress,
});

const { halfSigned } = halfSignedTx as any;
const { halfSigned } = halfSignedTx as HalfSignedEthLikeRecoveryTx;
const fullSignedTx = await coin.signTransaction({
isLastSignature: true,
prv: backupPrv,
Expand Down
7 changes: 4 additions & 3 deletions src/enclavedBitgoExpress/routers/enclavedApiSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ const RecoveryMultisigRequest = {
userPub: t.string,
backupPub: t.string,
apiKey: t.string,
// TODO: best typing for this, they come from sdk TS types
unsignedSweepPrebuildTx: t.any,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pranavjain97 this one remains untyped by the time, we discussed a couple of solutions with Mohammad but no one seems to work and trying to pass the record with string/unknown raises a conflict with api-ts routes.
We could follow up later in case that some of us discover first how to type this kind of objects that contains a few known fields and a group of anything else.

walletContractAddress: t.string,
coinSpecificParams: t.union([
t.undefined,
t.partial({
Expand All @@ -71,8 +71,9 @@ const RecoveryMultisigRequest = {

// Response type for /multisig/recovery endpoint
const RecoveryMultisigResponse: HttpResponse = {
// TODO: Define proper response type for recovery multisig transaction
200: t.any, // the full signed tx
200: t.type({
txHex: t.string,
}), // the full signed tx
500: t.type({
error: t.string,
details: t.string,
Expand Down
4 changes: 3 additions & 1 deletion src/masterBitgoExpress/routers/masterApiSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ export const SendManyResponse: HttpResponse = {
// Response type for /recovery endpoint
const RecoveryWalletResponse: HttpResponse = {
// TODO: Get type from public types repo
200: t.any,
200: t.type({
txHex: t.string, // the full signed transaction hex
}),
500: t.type({
error: t.string,
details: t.string,
Expand Down
10 changes: 10 additions & 0 deletions src/types/transaction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { type Recipient, type SignedTransaction } from 'bitgo';

export type HalfSignedEthLikeRecoveryTx = SignedTransaction & {
halfSigned: {
signatures?: string;
recipients?: Recipient[];
signingKeyNonce?: number;
backupKeyNonce?: number;
};
};