Skip to content

Commit

Permalink
Merge pull request #175 from ensdomains/feat/viem-v2
Browse files Browse the repository at this point in the history
feat: viem v2 support
  • Loading branch information
TateB authored Apr 3, 2024
2 parents 7e01ad8 + 433a906 commit d889a30
Show file tree
Hide file tree
Showing 146 changed files with 1,948 additions and 2,974 deletions.
13 changes: 1 addition & 12 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,8 @@
"prettier",
"plugin:prettier/recommended"
],
"plugins": ["@typescript-eslint", "prettier", "jest"],
"plugins": ["@typescript-eslint", "prettier"],
"parser": "@typescript-eslint/parser",
"overrides": [
{
"files": ["**/*.spec.ts"],
"env": { "jest/globals": true },
"globals": {
"context": "readonly"
},
"plugins": ["jest"],
"extends": ["plugin:jest/recommended"]
}
],
"parserOptions": {
"project": "./tsconfig.json"
},
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ jobs:
run: pnpm -F @ensdomains/ensjs lint

- name: Type check
run: pnpm -F @ensdomains/ensjs exec tsc --project tsconfig.build.json --noEmit --emitDeclarationOnly false
run: pnpm -F @ensdomains/ensjs build
2 changes: 1 addition & 1 deletion docs/dns/function.importDnsName.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const hash = await importDnsName(wallet, {

| Parameter | Type | Description |
| :----------- | :-------------------------------------------------------------------- | :---------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `ImportDnsNameParameters`\< `TChain`, `TAccount`, `TChainOverride` \> | ImportDnsNameParameters |

## Returns
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.clearRecords.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const hash = await clearRecords(wallet, {

| Parameter | Type | Description |
| :--------------------------- | :--------------- | :---------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | ClearRecordsParameters |
| `parameters.name` | `string` | The name to clear records for |
| `parameters.resolverAddress` | \`0x$\{string}\` | The resolver address to use |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.commitName.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const hash = await commitName(wallet, {

| Parameter | Type | Description |
| :---------------------------- | :---------------------------- | :---------------------------------------------------------------------- | -------------------------------------------------------------- | ------------------------------ | -------------------------- | ------------- | -------------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | CommitNameParameters |
| `parameters.duration` | `number` | Duration of registration |
| `parameters.fuses`? | `EncodeChildFusesInputObject` | Fuses to set upon registration |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.createSubname.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const hash = await createSubname(wallet, {

| Parameter | Type | Description |
| :----------- | :-------------------------------------------------------------------- | :---------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `CreateSubnameParameters`\< `TChain`, `TAccount`, `TChainOverride` \> | CreateSubnameParameters |

## Returns
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.deleteSubname.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const hash = await deleteSubname(wallet, {

| Parameter | Type | Description |
| :-------------------- | :------------------------------ | :--------------------------------------------------------------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | DeleteSubnameParameters |
| `parameters.asOwner`? | `boolean` | If true, deletes via owner methods, otherwise will delete via parent owner methods |
| `parameters.contract` | `"nameWrapper"` \| `"registry"` | Contract to delete subname on |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.registerName.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const hash = await registerName(wallet, { ...params, value })

| Parameter | Type | Description |
| :---------------------------- | :---------------------------- | :---------------------------------------------------------------------- | -------------------------------------------------------------- | ------------------------------ | -------------------------- | ------------- | -------------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | RegisterNameParameters |
| `parameters.duration` | `number` | Duration of registration |
| `parameters.fuses`? | `EncodeChildFusesInputObject` | Fuses to set upon registration |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.renewNames.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const hash = await renewNames(wallet, {

| Parameter | Type | Description |
| :----------------------- | :--------------------- | :---------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | RenewNamesParameters |
| `parameters.duration` | `number` \| `bigint` | Duration to renew name(s) for |
| `parameters.nameOrNames` | `string` \| `string`[] | Name or names to renew |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.setAbiRecord.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const hash = await setAbiRecord(wallet, {

| Parameter | Type | Description |
| :--------------------------- | :--------------------- | :----------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | SetAbiRecordParameters |
| `parameters.encodedAbi` | `null` \| `EncodedAbi` | Encoded ABI data to set |
| `parameters.name` | `string` | Name to set ABI for |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.setAddressRecord.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const hash = await setAddressRecord(wallet, {

| Parameter | Type | Description |
| :--------------------------- | :------------------- | :---------------------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | SetAddressRecordParameters |
| `parameters.coin` | `string` \| `number` | Coin ticker or ID to set |
| `parameters.name` | `string` | Name to set address record for |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.setChildFuses.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const hash = await setChildFuses(wallet, {

| Parameter | Type | Description |
| :------------------- | :----------------------- | :------------------------------------ |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | SetChildFusesParameters |
| `parameters.expiry`? | `number` \| `bigint` | Expiry to set for fuses |
| `parameters.fuses` | `EncodeFusesInputObject` | Fuse object or number value to set to |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.setContentHashRecord.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const hash = await setContentHashRecord(wallet, {

| Parameter | Type | Description |
| :--------------------------- | :----------------- | :-------------------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | SetContentHashRecordParameters |
| `parameters.contentHash` | `null` \| `string` | Content hash value |
| `parameters.name` | `string` | Name to set content hash for |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.setFuses.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const hash = await setFuses(wallet, {

| Parameter | Type | Description |
| :----------------- | :---------------------------- | :-------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | SetFusesParameters |
| `parameters.fuses` | `EncodeChildFusesInputObject` | Fuse object to set to |
| `parameters.name` | `string` | Name to set fuses for |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.setPrimaryName.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const hash = await setPrimaryName(wallet, {

| Parameter | Type | Description |
| :----------- | :--------------------------------------------------------------------- | :----------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `SetPrimaryNameParameters`\< `TChain`, `TAccount`, `TChainOverride` \> | SetPrimaryNameParameters |

## Returns
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.setRecords.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const hash = await setRecords(wallet, {

| Parameter | Type | Description |
| :--------------------------- | :---------------------------------------------------- | :------------------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | SetRecordsParameters |
| `parameters.abi`? | `Omit`\< `EncodeSetAbiParameters`, `"namehash"` \> | ABI value |
| `parameters.clearRecords`? | `boolean` | Clears all current records |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.setResolver.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const hash = await setResolver(wallet, {

| Parameter | Type | Description |
| :--------------------------- | :------------------------------ | :-------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | SetResolverParameters |
| `parameters.contract` | `"nameWrapper"` \| `"registry"` | Contract to set resolver on |
| `parameters.name` | `string` | Name to set resolver for |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.setTextRecord.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const hash = await setTextRecord(wallet, {

| Parameter | Type | Description |
| :--------------------------- | :----------------- | :-------------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | SetTextRecordParameters |
| `parameters.key` | `string` | The text record key to set |
| `parameters.name` | `string` | The name to set a text record for |
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.transferName.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const hash = await transferName(wallet, {

| Parameter | Type | Description |
| :----------- | :------------------------------------------------------------------- | :--------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `TransferNameParameters`\< `TChain`, `TAccount`, `TChainOverride` \> | TransferNameParameters |

## Returns
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.unwrapName.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const hash = await unwrapName(wallet, {

| Parameter | Type | Description |
| :----------- | :-------------------------------------------------------------------------- | :------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `UnwrapNameParameters`\< `TName`, `TChain`, `TAccount`, `TChainOverride` \> | UnwrapNameParameters |

## Returns
Expand Down
2 changes: 1 addition & 1 deletion docs/wallet/function.wrapName.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const hash = await wrapName(wallet, {

| Parameter | Type | Description |
| :---------------------------- | :----------------------------------------------------------------------------------------- | :---------------------------------- |
| `wallet` | `object` | WalletWithEns |
| `wallet` | `object` | ClientWithAccount |
| `parameters` | `object` | WrapNameParameters |
| `parameters.fuses`? | `GetNameType`\< `TName` \> _extends_ `"eth-2ld"` ? `EncodeChildFusesInputObject` : `never` | Fuses to set on wrap (eth-2ld only) |
| `parameters.name` | `TName` | The name to wrap |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"eslint-plugin-prettier": "^4.0.0",
"prettier": "^2.8.8",
"ts-node": "^10.7.0",
"typescript": "^5.1.6"
"typescript": "^5.3.2"
},
"resolutions": {
"@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@0.3.0-beta.13"
Expand Down
5 changes: 5 additions & 0 deletions packages/ensjs/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
"leadingUnderscore": "allowSingleOrDouble",
"trailingUnderscore": "allowSingleOrDouble"
},
{
"selector": "objectLiteralProperty",
"filter": { "regex": "\\d+", "match": true },
"format": null
},
{
"selector": "variable",
"format": ["camelCase", "UPPER_CASE"],
Expand Down
1 change: 1 addition & 0 deletions packages/ensjs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# hardhat
/cache
/artifacts
/coverage
README.md
LICENSE

Expand Down
2 changes: 1 addition & 1 deletion packages/ensjs/ens-test-env.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = {
{
command:
process.env.STATIC_ENS === 'true' ? 'pnpm test:static' : 'pnpm test',
name: 'jest',
name: 'vitest',
prefixColor: 'yellow.bold',
finishOnExit: true,
},
Expand Down
18 changes: 0 additions & 18 deletions packages/ensjs/jest.config.js

This file was deleted.

8 changes: 0 additions & 8 deletions packages/ensjs/jest.setup.ts

This file was deleted.

28 changes: 12 additions & 16 deletions packages/ensjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
"denv": "pnpm tenv start -ns -nb --extra-time 11368000 --verbosity 1",
"anvil": "pnpm denv --no-graph",
"start": "ts-node --files src/index.test.ts",
"test": "jest --runInBand",
"test:watch": "jest --watch --run-in-band",
"test": "vitest --no-file-parallelism",
"test:watch": "vitest --watch --no-file-parallelism",
"clean": "rm -rf ./dist ./README.md ./LICENSE",
"lint": "eslint ./src/* --no-error-on-unmatched-pattern",
"build:cjs": "tsc --project tsconfig.build.json --module commonjs --outDir ./dist/cjs --removeComments --verbatimModuleSyntax false && echo > ./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
Expand All @@ -99,15 +99,15 @@
},
"dependencies": {
"@adraffy/ens-normalize": "1.9.0",
"@ensdomains/address-encoder": "1.1.0",
"@ensdomains/address-encoder": "1.1.1",
"@ensdomains/content-hash": "3.1.0-rc.1",
"@ensdomains/dnsprovejs": "^0.5.1",
"abitype": "^0.8.0",
"abitype": "^1.0.0",
"dns-packet": "^5.3.1",
"graphql": "^16.3.0",
"graphql-request": "6.1.0",
"pako": "^2.1.0",
"traverse": "^0.6.6"
"traverse": "^0.6.8"
},
"devDependencies": {
"@ensdomains/buffer": "^0.0.13",
Expand All @@ -117,37 +117,33 @@
"@openzeppelin/contracts": "^4.5.0",
"@openzeppelin/test-helpers": "^0.5.16",
"@swc/core": "^1.3.61",
"@swc/jest": "^0.2.26",
"@types/bn.js": "^5.1.0",
"@types/fs-extra": "^11.0.1",
"@types/jest": "^27.4.1",
"@types/node": "^20.3.3",
"@types/pako": "^2.0.0",
"@types/traverse": "^0.6.32",
"@types/traverse": "^0.6.36",
"@vitest/coverage-v8": "^1.3.1",
"cbor": "^8.1.0",
"dotenv": "^16.0.0",
"esbuild": "^0.15.6",
"eslint-plugin-jest": "^27.0.1",
"ethers": "^5.7.2",
"fs-extra": "^10.0.1",
"glob": "^8.0.3",
"happy-dom": "^13.3.8",
"hardhat": "2.16.1",
"hardhat-abi-exporter": "^2.8.0",
"hardhat-deploy": "^0.11.12",
"jest": "^29.5.0",
"jest-environment-node": "^29.5.0",
"jest-localstorage-mock": "^2.4.21",
"multiformats": "^12.0.1",
"solc": "^0.8.13",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.2",
"typedoc": "^0.24.8",
"typedoc-plugin-markdown": "^4.0.0-next.16",
"typescript": "^5.1.6",
"viem": "^1.16.4",
"typescript": "5.3.2",
"viem": "^2.5.0",
"vitest": "^1.3.1",
"wait-on": "^6.0.1"
},
"peerDependencies": {
"viem": "^1.16.4"
"viem": "^2.5.0"
}
}
Loading

0 comments on commit d889a30

Please sign in to comment.