Skip to content

Commit

Permalink
remove unnecessary types and methods
Browse files Browse the repository at this point in the history
  • Loading branch information
owencraston committed Sep 15, 2023
1 parent 65dd622 commit 2c5dcf5
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions packages/rpc-methods/src/restricted/manageAccounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ type Message = Infer<typeof SnapMessageStruct>;

export const methodName = 'snap_manageAccounts';

type AccountConfirmationResult = {
confirmed: boolean;
accountName?: string;
};

export type ManageAccountsMethodHooks = {
/**
* Gets the snap keyring implementation.
Expand All @@ -48,19 +43,9 @@ export type ManageAccountsMethodHooks = {
message: Message,
) => Promise<Json>;
}>;

showSnapAccountConfirmation: (
origin: any,
type: any,
content: any,
placeholder: any,
) => Promise<AccountConfirmationResult>;
startApprovalFlow: (opts?: StartFlowOptions) => ApprovalFlowStartResult;
requestUserApproval: (
opts: AddApprovalOptions,
) => Promise<AccountConfirmationResult>;
requestUserApproval: (opts: AddApprovalOptions) => Promise<boolean>;
endApprovalFlow: ({ id }: EndFlowOptions) => Promise<void>;
// setApprovalFlowLoadingText: () => Promise<void>;
showApprovalSuccess: (opts?: SuccessOptions) => Promise<SuccessResult>;
showApprovalError: (opts?: ErrorOptions) => Promise<ErrorResult>;
};
Expand Down Expand Up @@ -142,20 +127,13 @@ export function manageAccountsImplementation({
type: 'snap_manageAccounts:confirmation',
});

// eslint-disable-next-line no-console
console.log(
'SNAPS/ manageAccountsImplementation/ confirmationResult',
confirmationResult,
);
if (confirmationResult.confirmed) {
if (confirmationResult) {
try {
const account = await keyring.handleKeyringSnapMessage(origin, params);

const accountName = confirmationResult.accountName ?? '[Empty]';

await showApprovalSuccess({
flowToEnd: addAccountApprovalId,
message: `Added Account: **${accountName}**`,
message: 'Your account is ready!',
});

return account;
Expand All @@ -173,7 +151,6 @@ export const manageAccountsBuilder = Object.freeze({
specificationBuilder,
methodHooks: {
getSnapKeyring: true,
showSnapAccountConfirmation: true,
startApprovalFlow: true,
requestUserApproval: true,
endApprovalFlow: true,
Expand Down

0 comments on commit 2c5dcf5

Please sign in to comment.