Skip to content

Commit

Permalink
Merge pull request #482 from BitGo/WIN-3296-sui-consolidations-recover
Browse files Browse the repository at this point in the history
feat(sui): build unsigned consolidations
  • Loading branch information
hitansh-bitgo authored Aug 21, 2024
2 parents 074137d + 278b25c commit 228e002
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 1 deletion.
4 changes: 3 additions & 1 deletion electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,9 @@ async function createWindow() {
case 'ada':
case 'tada':
case 'dot':
case 'tdot': {
case 'tdot':
case 'sui':
case 'tsui': {
const mpcCoin = sdk.coin(coin) as Ada | Tada | Dot | Tdot;
return await mpcCoin.recoverConsolidations(params);
}
Expand Down
4 changes: 4 additions & 0 deletions electron/preload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import {
DotRecoveryConsolidationRecoveryOptions,
SolRecoverConsolidationRecoveryBatch,
SolRecoveryConsolidationRecoveryOptions,
SuiRecoverConsolidationRecoveryBatch,
SuiRecoveryConsolidationRecoveryOptions,
} from '../types';

import type * as EthLikeCommon from '@ethereumjs/common';
Expand Down Expand Up @@ -62,12 +64,14 @@ type Commands = {
| AdaRecoveryConsolidationRecoveryOptions
| DotRecoveryConsolidationRecoveryOptions
| SolRecoveryConsolidationRecoveryOptions
| SuiRecoveryConsolidationRecoveryOptions
): Promise<
| Error
| TrxConsolidationRecoveryBatch
| AdaRecoveryConsolidationRecoveryBatch
| DotRecoverConsolidationRecoveryBatch
| SolRecoverConsolidationRecoveryBatch
| SuiRecoverConsolidationRecoveryBatch
>;
writeFile(
file: string,
Expand Down
6 changes: 6 additions & 0 deletions electron/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ export type DotRecoveryConsolidationRecoveryOptions =
export type SolRecoveryConsolidationRecoveryOptions =
| Parameters<Sol['recoverConsolidations']>[0]
| Parameters<Tsol['recoverConsolidations']>[0];
export type SuiRecoveryConsolidationRecoveryOptions =
| Parameters<Sui['recoverConsolidations']>[0]
| Parameters<Tsui['recoverConsolidations']>[0];
export type TrxConsolidationRecoveryOptions = ConsolidationRecoveryOptions;

export type AdaRecoveryConsolidationRecoveryBatch = Awaited<
Expand All @@ -68,4 +71,7 @@ export type DotRecoverConsolidationRecoveryBatch = Awaited<
export type SolRecoverConsolidationRecoveryBatch = Awaited<
ReturnType<Sol['recoverConsolidations'] | Tsol['recoverConsolidations']>
>;
export type SuiRecoverConsolidationRecoveryBatch = Awaited<
ReturnType<Sui['recoverConsolidations'] | Tsui['recoverConsolidations']>
>;
export type TrxConsolidationRecoveryBatch = ConsolidationRecoveryBatch;
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ function ConsolidationForm({ coin, environment }: ConsolidationFormProps) {
case 'tada':
case 'dot':
case 'tdot':
case 'sui':
case 'tsui':
return (
<GenericEcdsaForm
onSubmit={async (values, { setSubmitting }) => {
Expand Down
2 changes: 2 additions & 0 deletions src/helpers/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ export const buildUnsignedConsolidationCoins: Record<
allCoinMetas.dot,
allCoinMetas.sol,
allCoinMetas.solToken,
allCoinMetas.sui,
],
test: [
allCoinMetas.ttrx,
Expand All @@ -613,6 +614,7 @@ export const buildUnsignedConsolidationCoins: Record<
allCoinMetas.tdot,
allCoinMetas.tsol,
allCoinMetas.tsolToken,
allCoinMetas.tsui,
],
};

Expand Down
6 changes: 6 additions & 0 deletions src/preload.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import {
DotRecoveryConsolidationRecoveryOptions,
SolRecoverConsolidationRecoveryBatch,
SolRecoveryConsolidationRecoveryOptions,
SuiRecoverConsolidationRecoveryBatch,
SuiRecoveryConsolidationRecoveryOptions,
TrxConsolidationRecoveryBatch,
TrxConsolidationRecoveryOptions,
} from '~/utils/types';
Expand Down Expand Up @@ -58,12 +60,14 @@ type Commands = {
| AdaRecoveryConsolidationRecoveryOptions
| DotRecoveryConsolidationRecoveryOptions
| SolRecoveryConsolidationRecoveryOptions
| SuiRecoveryConsolidationRecoveryOptions
): Promise<
| Error
| TrxConsolidationRecoveryBatch
| AdaRecoveryConsolidationRecoveryBatch
| DotRecoverConsolidationRecoveryBatch
| SolRecoverConsolidationRecoveryBatch
| SuiRecoverConsolidationRecoveryBatch
>;
writeFile(
file: string,
Expand Down Expand Up @@ -164,12 +168,14 @@ const commands: Commands = {
| AdaRecoveryConsolidationRecoveryOptions
| DotRecoveryConsolidationRecoveryOptions
| SolRecoveryConsolidationRecoveryOptions
| SuiRecoveryConsolidationRecoveryOptions
): Promise<
| Error
| TrxConsolidationRecoveryBatch
| AdaRecoveryConsolidationRecoveryBatch
| DotRecoverConsolidationRecoveryBatch
| SolRecoverConsolidationRecoveryBatch
| SuiRecoverConsolidationRecoveryBatch
> {
return ipcRenderer.invoke('recoverConsolidations', coin, params);
},
Expand Down
6 changes: 6 additions & 0 deletions src/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ export type DotRecoveryConsolidationRecoveryOptions =
export type SolRecoveryConsolidationRecoveryOptions =
| Parameters<Sol['recoverConsolidations']>[0]
| Parameters<Tsol['recoverConsolidations']>[0];
export type SuiRecoveryConsolidationRecoveryOptions =
| Parameters<Sui['recoverConsolidations']>[0]
| Parameters<Tsui['recoverConsolidations']>[0];
export type TrxConsolidationRecoveryOptions = ConsolidationRecoveryOptions;

export type AdaRecoveryConsolidationRecoveryBatch = Awaited<
Expand All @@ -78,4 +81,7 @@ export type DotRecoverConsolidationRecoveryBatch = Awaited<
export type SolRecoverConsolidationRecoveryBatch = Awaited<
ReturnType<Sol['recoverConsolidations'] | Tsol['recoverConsolidations']>
>;
export type SuiRecoverConsolidationRecoveryBatch = Awaited<
ReturnType<Sui['recoverConsolidations'] | Tsui['recoverConsolidations']>
>;
export type TrxConsolidationRecoveryBatch = ConsolidationRecoveryBatch;

0 comments on commit 228e002

Please sign in to comment.