Skip to content

Commit

Permalink
Merge branch 'feat/sf-801' into feat/sf-802
Browse files Browse the repository at this point in the history
  • Loading branch information
khanti42 committed Feb 13, 2025
2 parents c62c00f + 385d106 commit 0b7c3f7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/starknet-snap/src/rpcs/set-account-name.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ describe('SetAccountName', () => {

mockAccountContractReader({});

const { getAccountSpy } = mockAccountStateManager();
const { getAccountSpy, getCurrentAccountSpy } = mockAccountStateManager();
getAccountSpy.mockResolvedValue(await account.serialize());
getCurrentAccountSpy.mockResolvedValue(await account.serialize());

const deriveAccountByAddressSpy = jest.spyOn(
AccountService.prototype,
Expand Down
6 changes: 4 additions & 2 deletions packages/starknet-snap/src/rpcs/set-account-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class SetAccountNameRpc extends AccountRpcController<
protected async handleRequest(
params: SetAccountNameParams,
): Promise<SetAccountNameResponse> {
const { accountName } = params;
const { accountName, chainId } = params;

const accMgt = new AccountStateManager();

Expand All @@ -56,7 +56,9 @@ export class SetAccountNameRpc extends AccountRpcController<
accountName,
});

return (await this.account.serialize()) as SetAccountNameResponse;
return (await accMgt.getCurrentAccount({
chainId,
})) as SetAccountNameResponse;
}
}

Expand Down
5 changes: 4 additions & 1 deletion packages/starknet-snap/src/wallet/account/service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,10 @@ describe('AccountService', () => {
expect(result).toStrictEqual(accountObj);
expect(addAccountSpy).toHaveBeenCalledWith(accountJsonData);
expect(setCurrentAccountSpy).toHaveBeenCalledWith(accountJsonData);
expect(deriveAccountByIndexSpy).toHaveBeenCalledWith(nextIndex, undefined);
expect(deriveAccountByIndexSpy).toHaveBeenCalledWith(
nextIndex,
undefined,
);
});
});
});

0 comments on commit 0b7c3f7

Please sign in to comment.