From 55f198ee8897ee04ab81141e3c40a928d1cf5922 Mon Sep 17 00:00:00 2001 From: Bhavi Dhingra Date: Thu, 8 Aug 2024 00:25:04 +0530 Subject: [PATCH] feat(sui): build unsigned consolidations Ticket: WIN-3296 --- electron/main/index.ts | 4 +++- electron/preload/index.ts | 4 ++++ electron/types.ts | 6 ++++++ .../BuildUnsignedConsolidationCoin.tsx | 2 ++ src/helpers/config.ts | 2 ++ src/preload.d.ts | 6 ++++++ src/utils/types.ts | 6 ++++++ 7 files changed, 29 insertions(+), 1 deletion(-) diff --git a/electron/main/index.ts b/electron/main/index.ts index e5cda818..6f75cd41 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -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); } diff --git a/electron/preload/index.ts b/electron/preload/index.ts index 62ef9d5d..b6d0c688 100644 --- a/electron/preload/index.ts +++ b/electron/preload/index.ts @@ -33,6 +33,8 @@ import { DotRecoveryConsolidationRecoveryOptions, SolRecoverConsolidationRecoveryBatch, SolRecoveryConsolidationRecoveryOptions, + SuiRecoverConsolidationRecoveryBatch, + SuiRecoveryConsolidationRecoveryOptions, } from '../types'; import type * as EthLikeCommon from '@ethereumjs/common'; @@ -62,12 +64,14 @@ type Commands = { | AdaRecoveryConsolidationRecoveryOptions | DotRecoveryConsolidationRecoveryOptions | SolRecoveryConsolidationRecoveryOptions + | SuiRecoveryConsolidationRecoveryOptions ): Promise< | Error | TrxConsolidationRecoveryBatch | AdaRecoveryConsolidationRecoveryBatch | DotRecoverConsolidationRecoveryBatch | SolRecoverConsolidationRecoveryBatch + | SuiRecoverConsolidationRecoveryBatch >; writeFile( file: string, diff --git a/electron/types.ts b/electron/types.ts index af9e0415..b3e895cf 100644 --- a/electron/types.ts +++ b/electron/types.ts @@ -57,6 +57,9 @@ export type DotRecoveryConsolidationRecoveryOptions = export type SolRecoveryConsolidationRecoveryOptions = | Parameters[0] | Parameters[0]; +export type SuiRecoveryConsolidationRecoveryOptions = + | Parameters[0] + | Parameters[0]; export type TrxConsolidationRecoveryOptions = ConsolidationRecoveryOptions; export type AdaRecoveryConsolidationRecoveryBatch = Awaited< @@ -68,4 +71,7 @@ export type DotRecoverConsolidationRecoveryBatch = Awaited< export type SolRecoverConsolidationRecoveryBatch = Awaited< ReturnType >; +export type SuiRecoverConsolidationRecoveryBatch = Awaited< + ReturnType +>; export type TrxConsolidationRecoveryBatch = ConsolidationRecoveryBatch; diff --git a/src/containers/BuildUnsignedConsolidation/BuildUnsignedConsolidationCoin.tsx b/src/containers/BuildUnsignedConsolidation/BuildUnsignedConsolidationCoin.tsx index d0b665ce..dce3dda9 100644 --- a/src/containers/BuildUnsignedConsolidation/BuildUnsignedConsolidationCoin.tsx +++ b/src/containers/BuildUnsignedConsolidation/BuildUnsignedConsolidationCoin.tsx @@ -154,6 +154,8 @@ function ConsolidationForm({ coin, environment }: ConsolidationFormProps) { case 'tada': case 'dot': case 'tdot': + case 'sui': + case 'tsui': return ( { diff --git a/src/helpers/config.ts b/src/helpers/config.ts index 6afb8baa..70f84f13 100644 --- a/src/helpers/config.ts +++ b/src/helpers/config.ts @@ -605,6 +605,7 @@ export const buildUnsignedConsolidationCoins: Record< allCoinMetas.dot, allCoinMetas.sol, allCoinMetas.solToken, + allCoinMetas.sui, ], test: [ allCoinMetas.ttrx, @@ -613,6 +614,7 @@ export const buildUnsignedConsolidationCoins: Record< allCoinMetas.tdot, allCoinMetas.tsol, allCoinMetas.tsolToken, + allCoinMetas.tsui, ], }; diff --git a/src/preload.d.ts b/src/preload.d.ts index 834bcd39..7e074c23 100644 --- a/src/preload.d.ts +++ b/src/preload.d.ts @@ -28,6 +28,8 @@ import { DotRecoveryConsolidationRecoveryOptions, SolRecoverConsolidationRecoveryBatch, SolRecoveryConsolidationRecoveryOptions, + SuiRecoverConsolidationRecoveryBatch, + SuiRecoveryConsolidationRecoveryOptions, TrxConsolidationRecoveryBatch, TrxConsolidationRecoveryOptions, } from '~/utils/types'; @@ -58,12 +60,14 @@ type Commands = { | AdaRecoveryConsolidationRecoveryOptions | DotRecoveryConsolidationRecoveryOptions | SolRecoveryConsolidationRecoveryOptions + | SuiRecoveryConsolidationRecoveryOptions ): Promise< | Error | TrxConsolidationRecoveryBatch | AdaRecoveryConsolidationRecoveryBatch | DotRecoverConsolidationRecoveryBatch | SolRecoverConsolidationRecoveryBatch + | SuiRecoverConsolidationRecoveryBatch >; writeFile( file: string, @@ -164,12 +168,14 @@ const commands: Commands = { | AdaRecoveryConsolidationRecoveryOptions | DotRecoveryConsolidationRecoveryOptions | SolRecoveryConsolidationRecoveryOptions + | SuiRecoveryConsolidationRecoveryOptions ): Promise< | Error | TrxConsolidationRecoveryBatch | AdaRecoveryConsolidationRecoveryBatch | DotRecoverConsolidationRecoveryBatch | SolRecoverConsolidationRecoveryBatch + | SuiRecoverConsolidationRecoveryBatch > { return ipcRenderer.invoke('recoverConsolidations', coin, params); }, diff --git a/src/utils/types.ts b/src/utils/types.ts index 9cfeddc0..400ebb52 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -67,6 +67,9 @@ export type DotRecoveryConsolidationRecoveryOptions = export type SolRecoveryConsolidationRecoveryOptions = | Parameters[0] | Parameters[0]; +export type SuiRecoveryConsolidationRecoveryOptions = + | Parameters[0] + | Parameters[0]; export type TrxConsolidationRecoveryOptions = ConsolidationRecoveryOptions; export type AdaRecoveryConsolidationRecoveryBatch = Awaited< @@ -78,4 +81,7 @@ export type DotRecoverConsolidationRecoveryBatch = Awaited< export type SolRecoverConsolidationRecoveryBatch = Awaited< ReturnType >; +export type SuiRecoverConsolidationRecoveryBatch = Awaited< + ReturnType +>; export type TrxConsolidationRecoveryBatch = ConsolidationRecoveryBatch;