Skip to content

Commit

Permalink
refactor: restructure osx-commons-sdk (#73)
Browse files Browse the repository at this point in the history
* chore: folder restructure

* chore: delete examples from sdk 1.0

* fix: prettier

* fix: broken dependency

* fix: broken dependency

* fix: update yarn.lock

* fix: tests missing dependency

* fix: apply code structure suggestions

* fix: remove regex.ts

* fix: pr comments

* update: package.json version
  • Loading branch information
josemarinas authored Apr 18, 2024
1 parent 871f039 commit 1c745cc
Show file tree
Hide file tree
Showing 55 changed files with 310 additions and 1,960 deletions.
63 changes: 0 additions & 63 deletions sdk/examples/01-extended-context.ts

This file was deleted.

61 changes: 0 additions & 61 deletions sdk/examples/02-extended-client.ts

This file was deleted.

16 changes: 4 additions & 12 deletions sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@aragon/osx-commons-sdk",
"author": "Aragon Association",
"version": "0.0.1-alpha.7",
"version": "0.0.1-alpha.8",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/osx-commons-sdk.esm.js",
Expand Down Expand Up @@ -43,6 +43,7 @@
}
],
"devDependencies": {
"@aragon/osx-ethers": "1.3.0",
"@size-limit/preset-small-lib": "^7.0.8",
"@types/node": "^20.10.0",
"dts-cli": "^2.0.3",
Expand All @@ -53,19 +54,10 @@
},
"dependencies": {
"@aragon/osx-commons-configs": "^0.4.0",
"@aragon/osx-ethers": "^1.3.0-rc0.4",
"@aragon/osx-ethers-v1.0.0": "npm:@aragon/[email protected]",
"@aragon/sdk-ipfs": "^1.1.0",
"@ethersproject/abstract-signer": "^5.7.0",
"@ethersproject/bignumber": "^5.7.0",
"@ethersproject/constants": "^5.7.0",
"@ethersproject/contracts": "^5.7.0",
"@ethersproject/hash": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"@ethersproject/wallet": "^5.7.0",
"graphql": "^16.5.0",
"graphql-request": "^4.3.0",
"ipfs-http-client": "^51.0.0",
"yup": "^1.2.0"
"@ethersproject/providers": "^5.7.0",
"ipfs-http-client": "^51.0.0"
}
}
2 changes: 1 addition & 1 deletion sdk/src/bitmap/utils.ts → sdk/src/bitmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
InvalidBitMapValueError,
InvalidBitPositionError,
} from './errors';
import {BigNumber} from 'ethers';
import {BigNumber} from '@ethersproject/bignumber';

/**
* Flips a specific bit in a `BigNumber` object and returns a new `BigNumber` object with the bit flipped.
Expand Down
22 changes: 0 additions & 22 deletions sdk/src/bitmap/errors.ts

This file was deleted.

2 changes: 0 additions & 2 deletions sdk/src/bitmap/index.ts

This file was deleted.

15 changes: 0 additions & 15 deletions sdk/src/constants.ts

This file was deleted.

26 changes: 24 additions & 2 deletions sdk/src/ens/utils.ts → sdk/src/ens.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {InvalidEnsError, UnsupportedNetworkError} from '../errors';
import {isEnsName} from '../validation';
import {InvalidEnsError, UnsupportedNetworkError} from './errors';
import {getNetworkByAlias} from '@aragon/osx-commons-configs';
import {Networkish} from '@ethersproject/networks';
import {JsonRpcProvider, Provider} from '@ethersproject/providers';

const ENS_REGEX = /^(?:[a-z0-9-]+\.)*[a-z0-9-]+\.eth$/;
const SUBDOMAIN_REGEX = /^[a-z0-9-]+$/;

/**
* Resolves an ENS name to an address given a provider
*
Expand Down Expand Up @@ -35,3 +37,23 @@ export function resolveEnsName(
}
return provider.resolveName(ensName);
}
/**
* Checks if the given string is a valid ENS name
*
* @export
* @param {string} name
* @return {*} {boolean}
*/
export function isEnsName(name: string): boolean {
return ENS_REGEX.test(name);
}
/**
* Checks if the given string is a valid subdomain
*
* @export
* @param {string} name
* @return {*} {boolean}
*/
export function isSubdomain(name: string): boolean {
return SUBDOMAIN_REGEX.test(name);
}
1 change: 0 additions & 1 deletion sdk/src/ens/index.ts

This file was deleted.

Loading

0 comments on commit 1c745cc

Please sign in to comment.