Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sui): create broadcastable MPC transaction #467

Closed
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
8 changes: 6 additions & 2 deletions electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,18 @@ async function createWindow() {
case 'dot':
case 'tdot':
case 'sol':
case 'tsol': {
case 'tsol':
case 'sui':
case 'tsui': {
const coinInstance = sdk.coin(coin) as
| Ada
| Tada
| Dot
| Tdot
| Sol
| Tsol;
| Tsol
| Sui
| Tsui;
return coinInstance.createBroadcastableSweepTransaction(parameters);
}
default:
Expand Down
2 changes: 2 additions & 0 deletions electron/preload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
createAdaBroadcastableSweepTransactionParameters,
createDotBroadcastableSweepTransactionParameters,
createSolBroadcastableSweepTransactionParameters,
createSuiBroadcastableSweepTransactionParameters,
DotRecoverConsolidationRecoveryBatch,
DotRecoveryConsolidationRecoveryOptions,
SolRecoverConsolidationRecoveryBatch,
Expand All @@ -50,6 +51,7 @@ type Commands = {
| createAdaBroadcastableSweepTransactionParameters
| createDotBroadcastableSweepTransactionParameters
| createSolBroadcastableSweepTransactionParameters
| createSuiBroadcastableSweepTransactionParameters
): Promise<Error | BroadcastableSweepTransaction>;
unlock(otp: string);
sweepV1(coin: string, parameters: V1SweepParams): ReturnType<typeof v1Sweep>;
Expand Down
5 changes: 5 additions & 0 deletions electron/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export type createDotBroadcastableSweepTransactionParameters =
export type createSolBroadcastableSweepTransactionParameters =
| Parameters<Sol['createBroadcastableSweepTransaction']>[0]
| Parameters<Tsol['createBroadcastableSweepTransaction']>[0];
export type createSuiBroadcastableSweepTransactionParameters =
| Parameters<Sui['createBroadcastableSweepTransaction']>[0]
| Parameters<Tsui['createBroadcastableSweepTransaction']>[0];

export type BroadcastableSweepTransaction = Awaited<
ReturnType<
Expand All @@ -27,6 +30,8 @@ export type BroadcastableSweepTransaction = Awaited<
| Tdot['createBroadcastableSweepTransaction']
| Sol['createBroadcastableSweepTransaction']
| Tsol['createBroadcastableSweepTransaction']
| Sui['createBroadcastableSweepTransaction']
| Tsui['createBroadcastableSweepTransaction']
>
>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type {
createAdaBroadcastableSweepTransactionParameters,
createDotBroadcastableSweepTransactionParameters,
createSolBroadcastableSweepTransactionParameters,
createSuiBroadcastableSweepTransactionParameters,
} from '~/utils/types';
import { assert, safeEnv } from '~/helpers';
import { useAlertBanner } from '~/contexts';
Expand All @@ -31,11 +32,13 @@ function isSignedTransaction(
): json is
| createAdaBroadcastableSweepTransactionParameters
| createDotBroadcastableSweepTransactionParameters
| createSolBroadcastableSweepTransactionParameters {
| createSolBroadcastableSweepTransactionParameters
| createSuiBroadcastableSweepTransactionParameters {
const signedTransaction = json as
| createAdaBroadcastableSweepTransactionParameters
| createDotBroadcastableSweepTransactionParameters
| createSolBroadcastableSweepTransactionParameters;
| createSolBroadcastableSweepTransactionParameters
| createSuiBroadcastableSweepTransactionParameters;
return (
signedTransaction &&
signedTransaction.signatureShares !== undefined &&
Expand Down Expand Up @@ -64,7 +67,8 @@ export function CreateBroadcastableTransactionIndex() {
const tx = JSON.parse(event.target?.result as string) as
| createAdaBroadcastableSweepTransactionParameters
| createDotBroadcastableSweepTransactionParameters
| createSolBroadcastableSweepTransactionParameters;
| createSolBroadcastableSweepTransactionParameters
| createSuiBroadcastableSweepTransactionParameters;

assert(isSignedTransaction(tx), 'Signed transaction not found');

Expand Down
2 changes: 2 additions & 0 deletions src/preload.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
createAdaBroadcastableSweepTransactionParameters,
createDotBroadcastableSweepTransactionParameters,
createSolBroadcastableSweepTransactionParameters,
createSuiBroadcastableSweepTransactionParameters,
DotRecoverConsolidationRecoveryBatch,
DotRecoveryConsolidationRecoveryOptions,
SolRecoverConsolidationRecoveryBatch,
Expand All @@ -46,6 +47,7 @@ type Commands = {
| createAdaBroadcastableSweepTransactionParameters
| createDotBroadcastableSweepTransactionParameters
| createSolBroadcastableSweepTransactionParameters
| createSuiBroadcastableSweepTransactionParameters
): Promise<Error | BroadcastableSweepTransaction>;
unlock(otp: string);
sweepV1(coin: string, parameters);
Expand Down
5 changes: 5 additions & 0 deletions src/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export type createDotBroadcastableSweepTransactionParameters =
export type createSolBroadcastableSweepTransactionParameters =
| Parameters<Sol['createBroadcastableSweepTransaction']>[0]
| Parameters<Tsol['createBroadcastableSweepTransaction']>[0];
export type createSuiBroadcastableSweepTransactionParameters =
| Parameters<Sui['createBroadcastableSweepTransaction']>[0]
| Parameters<Tsui['createBroadcastableSweepTransaction']>[0];

export type BroadcastableSweepTransaction = Awaited<
ReturnType<
Expand All @@ -27,6 +30,8 @@ export type BroadcastableSweepTransaction = Awaited<
| Tdot['createBroadcastableSweepTransaction']
| Sol['createBroadcastableSweepTransaction']
| Tsol['createBroadcastableSweepTransaction']
| Sui['createBroadcastableSweepTransaction']
| Tsui['createBroadcastableSweepTransaction']
>
>;

Expand Down