Skip to content

Commit

Permalink
fix: fixed identity rename props
Browse files Browse the repository at this point in the history
  • Loading branch information
olia-nistratova committed Oct 27, 2023
1 parent b95f0ba commit 77db160
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/background/handlers/Extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ export default class Extension extends DotExtension {
}

private polyIdentityRename({
address,
did,
name,
}: RequestPolyIdentityRename): boolean {
renameIdentity(address, name);
renameIdentity(did, name);

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/background/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export interface RequestPolyCallDetails {
}

export interface RequestPolyIdentityRename {
address: string;
did: string;
name: string;
}

Expand Down
8 changes: 3 additions & 5 deletions packages/core/src/store/features/identities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type SetIdentityPayload = {
};
};
type RenameIdentityPayload = {
account: string;
did: string;
name: string;
};

Expand All @@ -42,10 +42,8 @@ const identitiesSlice = createSlice({
state.currentDids[account] = currentDid;
},
renameIdentity(state, action: PayloadAction<RenameIdentityPayload>) {
const { account, name } = action.payload;
const currentDid = state.currentDids[account];

state.dids[currentDid].alias = name;
const { did, name } = action.payload;
state.dids[did].alias = name;
},
removeCurrentIdentity(state, action: PayloadAction<string>) {
delete state.currentDids[action.payload];
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/store/setters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ function setSelectedAccount(account: string): void {
store.dispatch(accountActions.selectAccount(account));
}

function renameIdentity(account: string, name: string) {
store.dispatch(identityActions.renameIdentity({ account, name }));
function renameIdentity(did: string, name: string) {
store.dispatch(identityActions.renameIdentity({ did, name }));
}

function resetState() {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Popup/Accounts/AccountsContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const AccountsContainer: FC<Props> = ({
return;
}

await renameIdentity(currentAccount?.address, newAlias);
await renameIdentity(currentAccount?.did, newAlias);
stopEditAlias();
onAction();
};
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/messaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,10 @@ export async function subscribePolyStatus(
}

export async function renameIdentity(
address: string,
did: string,
name: string
): Promise<boolean> {
return polyMessage('poly:pri(identity.rename)', { address, name });
return polyMessage('poly:pri(identity.rename)', { did, name });
}

export async function getPolyCallDetails(
Expand Down

0 comments on commit 77db160

Please sign in to comment.