Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Commit

Permalink
Remove usage of PromiseOrValue
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNeshi committed Aug 3, 2023
1 parent 146122c commit ec51517
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions test/core/accounts/AccountsUpdateEndowments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
Registrar__factory,
TestFacetProxyContract,
} from "typechain-types";
import {PromiseOrValue} from "typechain-types/common";
import {AccountMessages} from "typechain-types/contracts/core/accounts/facets/AccountsUpdateEndowments";
import {
AccountStorage,
Expand Down Expand Up @@ -240,7 +239,7 @@ describe("AccountsUpdateEndowments", function () {
});

async function expectNothingChanged(
endowId: PromiseOrValue<BigNumberish>,
endowId: BigNumberish,
oldEndow: AccountStorage.EndowmentStruct
) {
const updated = await state.getEndowmentDetails(endowId);
Expand Down
7 changes: 3 additions & 4 deletions test/core/accounts/utils/updateSettings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {BigNumberish} from "ethers";
import {PromiseOrValue} from "typechain-types/common";
import {
AccountStorage,
LibAccounts,
Expand All @@ -15,7 +14,7 @@ import {DeepPartial} from "utils/types";
* @returns the updated endowment
*/
export async function updateSettings(
endowId: PromiseOrValue<BigNumberish>,
endowId: BigNumberish,
field: keyof LibAccounts.SettingsControllerStruct,
settings: DeepPartial<LibAccounts.SettingsPermissionStruct>,
state: TestFacetProxyContract
Expand All @@ -41,7 +40,7 @@ export async function updateSettings(
* @returns the updated endowment data with all settings updated
*/
export async function updateAllSettings(
endowId: PromiseOrValue<BigNumberish>,
endowId: BigNumberish,
settings: DeepPartial<LibAccounts.SettingsPermissionStruct>,
state: TestFacetProxyContract
) {
Expand All @@ -51,7 +50,7 @@ export async function updateAllSettings(
lockedEndow.settingsController = (
Object.entries(lockedEndow.settingsController) as [
keyof LibAccounts.SettingsControllerStruct,
LibAccounts.SettingsPermissionStruct,
LibAccounts.SettingsPermissionStruct
][]
).reduce((controller, [key, curSetting]) => {
controller[key] = getUpdated(curSetting, settings);
Expand Down
3 changes: 1 addition & 2 deletions utils/types/common.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import {Overrides} from "ethers";
import {PromiseOrValue} from "typechain-types/common";

export type DeepPartial<T> = {
[K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
};

type Head<T extends any[]> = Required<T> extends [
...infer Head,
Overrides & {from?: PromiseOrValue<string>},
Overrides & {from?: string},
]
? Head
: never;
Expand Down

0 comments on commit ec51517

Please sign in to comment.