Skip to content

Commit

Permalink
Fix: ENS domain being required (#293)
Browse files Browse the repository at this point in the history
* fix ens domain bein required

* fix build

* fix code smell
  • Loading branch information
josemarinas authored Oct 24, 2023
1 parent c7fbf55 commit a9570ea
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 24 deletions.
6 changes: 6 additions & 0 deletions modules/client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ TEMPLATE:
-->

## [UPCOMING]

### Fixed

- Required ensSubdomain in createDao

## [1.16.2]
### Fixed

- Ens name regex
Expand Down
2 changes: 1 addition & 1 deletion modules/client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@aragon/sdk-client",
"author": "Aragon Association",
"version": "1.16.2",
"version": "1.16.3",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/sdk-client.esm.js",
Expand Down
6 changes: 3 additions & 3 deletions modules/client/src/internal/client/estimation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ export class ClientEstimation extends ClientCore implements IClientEstimation {

const gasEstimation = await daoInstance.estimateGas.createDao(
{
subdomain: params.ensSubdomain,
subdomain: params.ensSubdomain ?? "",
metadata: toUtf8Bytes(params.metadataUri),
daoURI: params.daoUri || "",
trustedForwarder: params.trustedForwarder || AddressZero,
daoURI: params.daoUri ?? "",
trustedForwarder: params.trustedForwarder ?? AddressZero,
},
pluginInstallationData,
);
Expand Down
6 changes: 3 additions & 3 deletions modules/client/src/internal/client/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,10 @@ export class ClientMethods extends ClientCore implements IClientMethods {

const tx = await daoFactoryInstance.connect(signer).createDao(
{
subdomain: params.ensSubdomain,
subdomain: params.ensSubdomain ?? "",
metadata: toUtf8Bytes(params.metadataUri),
daoURI: params.daoUri || "",
trustedForwarder: params.trustedForwarder || AddressZero,
daoURI: params.daoUri ?? "",
trustedForwarder: params.trustedForwarder ?? AddressZero,
},
pluginInstallationData,
);
Expand Down
2 changes: 1 addition & 1 deletion modules/client/src/internal/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { array, mixed, number, object, string } from "yup";
export const CreateDaoSchema = object({
metadataUri: IpfsUriSchema.required(),
daoUri: string().url().notRequired(),
ensSubdomain: SubdomainSchema.required(),
ensSubdomain: SubdomainSchema.notRequired(),
trustedForwarder: AddressOrEnsSchema.notRequired(),
plugins: array(PluginInstallItemSchema).min(1).required(),
});
Expand Down
2 changes: 1 addition & 1 deletion modules/client/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
export type CreateDaoParams = {
metadataUri: string;
daoUri?: string;
ensSubdomain: string;
ensSubdomain?: string;
trustedForwarder?: string;
plugins: PluginInstallItem[];
};
Expand Down
15 changes: 0 additions & 15 deletions modules/client/test/unit/client/schemas.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,6 @@ describe("Test client schemas", () => {
new ValidationError("metadataUri is a required field"),
);
});
it("should throw an error if the ensSubdomain is missing", () => {
const createDaoParams = {
metadataUri: TEST_IPFS_URI_V0,
plugins: [
{
id: TEST_ADDRESS,
data: new Uint8Array(),
},
],
};
expect(() => CreateDaoSchema.strict().validateSync(createDaoParams))
.toThrow(
new ValidationError("ensSubdomain is a required field"),
);
});
it("should throw an error if the plugins is missing", () => {
const createDaoParams = {
metadataUri: TEST_IPFS_URI_V0,
Expand Down

0 comments on commit a9570ea

Please sign in to comment.