@ensdomains/ensjs 3.0.0-alpha.42 → 3.0.0-alpha.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/contracts/getContractAddress.js +3 -3
- package/dist/cjs/functions/batch.js +14 -6
- package/dist/cjs/functions/getDecryptedName.js +111 -0
- package/dist/cjs/functions/getExpiry.js +2 -1
- package/dist/cjs/functions/getHistory.js +16 -9
- package/dist/cjs/functions/getOwner.js +5 -4
- package/dist/cjs/functions/getPrice.js +6 -6
- package/dist/cjs/functions/getProfile.js +11 -5
- package/dist/cjs/functions/getWrapperData.js +2 -2
- package/dist/cjs/functions/unwrapName.js +2 -1
- package/dist/cjs/functions/wrapName.js +4 -3
- package/dist/cjs/generated/factories/BaseRegistrarImplementation__factory.js +2 -2
- package/dist/cjs/generated/factories/BulkRenewal__factory.js +2 -2
- package/dist/cjs/generated/factories/DNSRegistrar__factory.js +2 -2
- package/dist/cjs/generated/factories/DNSSECImpl__factory.js +2 -2
- package/dist/cjs/generated/factories/DefaultReverseResolver__factory.js +2 -2
- package/dist/cjs/generated/factories/ENSRegistry__factory.js +2 -2
- package/dist/cjs/generated/factories/ETHRegistrarController__factory.js +2 -2
- package/dist/cjs/generated/factories/Multicall__factory.js +2 -2
- package/dist/cjs/generated/factories/NameWrapper__factory.js +2 -2
- package/dist/cjs/generated/factories/P256SHA256Algorithm__factory.js +2 -2
- package/dist/cjs/generated/factories/PublicResolver__factory.js +2 -2
- package/dist/cjs/generated/factories/RSASHA1Algorithm__factory.js +2 -2
- package/dist/cjs/generated/factories/RSASHA256Algorithm__factory.js +2 -2
- package/dist/cjs/generated/factories/ReverseRegistrar__factory.js +2 -2
- package/dist/cjs/generated/factories/Root__factory.js +2 -2
- package/dist/cjs/generated/factories/SHA1Digest__factory.js +2 -2
- package/dist/cjs/generated/factories/SHA1NSEC3Digest__factory.js +2 -2
- package/dist/cjs/generated/factories/SHA256Digest__factory.js +2 -2
- package/dist/cjs/generated/factories/StaticMetadataService__factory.js +2 -2
- package/dist/cjs/generated/factories/TLDPublicSuffixList__factory.js +2 -2
- package/dist/cjs/generated/factories/UniversalResolver__factory.js +2 -2
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/utils/ccip.js +4 -4
- package/dist/cjs/utils/fuses.js +3 -2
- package/dist/cjs/utils/hexEncodedName.js +2 -0
- package/dist/cjs/utils/labels.js +14 -8
- package/dist/cjs/utils/registerHelpers.js +2 -2
- package/dist/cjs/utils/singleCall.js +9 -1
- package/dist/cjs/utils/validation.js +2 -0
- package/dist/cjs/utils/wrapper.js +1 -1
- package/dist/esm/contracts/getContractAddress.mjs +3 -3
- package/dist/esm/functions/batch.mjs +14 -6
- package/dist/esm/functions/getDecryptedName.mjs +96 -0
- package/dist/esm/functions/getExpiry.mjs +2 -1
- package/dist/esm/functions/getHistory.mjs +16 -9
- package/dist/esm/functions/getOwner.mjs +3 -2
- package/dist/esm/functions/getPrice.mjs +2 -2
- package/dist/esm/functions/getProfile.mjs +10 -4
- package/dist/esm/functions/getWrapperData.mjs +2 -2
- package/dist/esm/functions/unwrapName.mjs +2 -1
- package/dist/esm/functions/wrapName.mjs +3 -2
- package/dist/esm/generated/factories/BaseRegistrarImplementation__factory.mjs +1 -1
- package/dist/esm/generated/factories/BulkRenewal__factory.mjs +1 -1
- package/dist/esm/generated/factories/DNSRegistrar__factory.mjs +1 -1
- package/dist/esm/generated/factories/DNSSECImpl__factory.mjs +1 -1
- package/dist/esm/generated/factories/DefaultReverseResolver__factory.mjs +1 -1
- package/dist/esm/generated/factories/ENSRegistry__factory.mjs +1 -1
- package/dist/esm/generated/factories/ETHRegistrarController__factory.mjs +1 -1
- package/dist/esm/generated/factories/Multicall__factory.mjs +1 -1
- package/dist/esm/generated/factories/NameWrapper__factory.mjs +1 -1
- package/dist/esm/generated/factories/P256SHA256Algorithm__factory.mjs +1 -1
- package/dist/esm/generated/factories/PublicResolver__factory.mjs +1 -1
- package/dist/esm/generated/factories/RSASHA1Algorithm__factory.mjs +1 -1
- package/dist/esm/generated/factories/RSASHA256Algorithm__factory.mjs +1 -1
- package/dist/esm/generated/factories/ReverseRegistrar__factory.mjs +1 -1
- package/dist/esm/generated/factories/Root__factory.mjs +1 -1
- package/dist/esm/generated/factories/SHA1Digest__factory.mjs +1 -1
- package/dist/esm/generated/factories/SHA1NSEC3Digest__factory.mjs +1 -1
- package/dist/esm/generated/factories/SHA256Digest__factory.mjs +1 -1
- package/dist/esm/generated/factories/StaticMetadataService__factory.mjs +1 -1
- package/dist/esm/generated/factories/TLDPublicSuffixList__factory.mjs +1 -1
- package/dist/esm/generated/factories/UniversalResolver__factory.mjs +1 -1
- package/dist/esm/index.mjs +2 -1
- package/dist/esm/utils/ccip.mjs +3 -3
- package/dist/esm/utils/fuses.mjs +3 -2
- package/dist/esm/utils/hexEncodedName.mjs +2 -0
- package/dist/esm/utils/labels.mjs +11 -8
- package/dist/esm/utils/registerHelpers.mjs +1 -1
- package/dist/esm/utils/singleCall.mjs +9 -1
- package/dist/esm/utils/validation.mjs +2 -0
- package/dist/esm/utils/wrapper.mjs +1 -1
- package/dist/types/functions/batch.d.ts +8 -1
- package/dist/types/functions/getDecryptedName.d.ts +9 -0
- package/dist/types/functions/getHistory.d.ts +16 -0
- package/dist/types/functions/getPrice.d.ts +1 -1
- package/dist/types/functions/getProfile.d.ts +1 -0
- package/dist/types/functions/getRecords.d.ts +1 -0
- package/dist/types/functions/registerName.d.ts +1 -1
- package/dist/types/functions/renewNames.d.ts +1 -1
- package/dist/types/functions/types.d.ts +2 -0
- package/dist/types/index.d.ts +32 -1
- package/dist/types/static.d.ts +1 -1
- package/dist/types/utils/fuses.d.ts +1 -0
- package/dist/types/utils/hexEncodedName.d.ts +1 -0
- package/dist/types/utils/labels.d.ts +2 -1
- package/dist/types/utils/singleCall.d.ts +1 -0
- package/dist/types/utils/validation.d.ts +1 -0
- package/dist/types/utils/wrapper.d.ts +1 -1
- package/package.json +2 -2
- package/src/contracts/getContractAddress.ts +3 -3
- package/src/functions/batch.ts +15 -5
- package/src/functions/ccip.test.ts +62 -0
- package/src/functions/createSubname.ts +1 -1
- package/src/functions/getDecryptedName.test.ts +49 -0
- package/src/functions/getDecryptedName.ts +119 -0
- package/src/functions/getExpiry.ts +3 -2
- package/src/functions/getHistory.test.ts +11 -0
- package/src/functions/getHistory.ts +16 -9
- package/src/functions/getNames.test.ts +1 -1
- package/src/functions/getOwner.ts +4 -3
- package/src/functions/getPrice.ts +2 -2
- package/src/functions/getProfile.test.ts +7 -0
- package/src/functions/getProfile.ts +13 -4
- package/src/functions/getWrapperData.test.ts +3 -0
- package/src/functions/getWrapperData.ts +2 -2
- package/src/functions/registerName.ts +1 -1
- package/src/functions/renewNames.ts +1 -1
- package/src/functions/types.ts +2 -0
- package/src/functions/unwrapName.ts +2 -1
- package/src/functions/wrapName.ts +3 -2
- package/src/generated/factories/BaseRegistrarImplementation__factory.ts +1 -1
- package/src/generated/factories/BulkRenewal__factory.ts +1 -1
- package/src/generated/factories/DNSRegistrar__factory.ts +1 -1
- package/src/generated/factories/DNSSECImpl__factory.ts +1 -1
- package/src/generated/factories/DefaultReverseResolver__factory.ts +1 -1
- package/src/generated/factories/ENSRegistry__factory.ts +1 -1
- package/src/generated/factories/ETHRegistrarController__factory.ts +1 -1
- package/src/generated/factories/Multicall__factory.ts +1 -1
- package/src/generated/factories/NameWrapper__factory.ts +1 -1
- package/src/generated/factories/P256SHA256Algorithm__factory.ts +1 -1
- package/src/generated/factories/PublicResolver__factory.ts +1 -1
- package/src/generated/factories/RSASHA1Algorithm__factory.ts +1 -1
- package/src/generated/factories/RSASHA256Algorithm__factory.ts +1 -1
- package/src/generated/factories/ReverseRegistrar__factory.ts +1 -1
- package/src/generated/factories/Root__factory.ts +1 -1
- package/src/generated/factories/SHA1Digest__factory.ts +1 -1
- package/src/generated/factories/SHA1NSEC3Digest__factory.ts +1 -1
- package/src/generated/factories/SHA256Digest__factory.ts +1 -1
- package/src/generated/factories/StaticMetadataService__factory.ts +1 -1
- package/src/generated/factories/TLDPublicSuffixList__factory.ts +1 -1
- package/src/generated/factories/UniversalResolver__factory.ts +1 -1
- package/src/index.ts +5 -1
- package/src/static.ts +1 -1
- package/src/utils/ccip.ts +3 -3
- package/src/utils/fuses.ts +4 -4
- package/src/utils/hexEncodedName.ts +3 -0
- package/src/utils/labels.ts +13 -11
- package/src/utils/registerHelpers.ts +1 -1
- package/src/utils/singleCall.ts +11 -6
- package/src/utils/validation.ts +3 -0
- package/src/utils/wrapper.ts +1 -1
- package/src/functions/getProfile-ccip.test.ts +0 -29
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { formatsByName } from '@ensdomains/address-encoder'
|
|
2
|
-
import { defaultAbiCoder } from '@ethersproject/abi
|
|
2
|
+
import { defaultAbiCoder } from '@ethersproject/abi'
|
|
3
3
|
import { hexStripZeros, isBytesLike } from '@ethersproject/bytes'
|
|
4
4
|
import { ENSArgs } from '..'
|
|
5
5
|
import { decodeContenthash, DecodedContentHash } from '../utils/contentHash'
|
|
@@ -37,6 +37,7 @@ type ResolvedProfile = {
|
|
|
37
37
|
createdAt: string | null
|
|
38
38
|
address?: string
|
|
39
39
|
name?: string | null
|
|
40
|
+
decryptedName?: string | null
|
|
40
41
|
match?: boolean
|
|
41
42
|
message?: string
|
|
42
43
|
records?: {
|
|
@@ -360,6 +361,7 @@ const graphFetch = async (
|
|
|
360
361
|
const query = gqlInstance.gql`
|
|
361
362
|
query getRecords($id: String!) {
|
|
362
363
|
domain(id: $id) {
|
|
364
|
+
name
|
|
363
365
|
isMigrated
|
|
364
366
|
createdAt
|
|
365
367
|
resolver {
|
|
@@ -377,6 +379,7 @@ const graphFetch = async (
|
|
|
377
379
|
const customResolverQuery = gqlInstance.gql`
|
|
378
380
|
query getRecordsWithCustomResolver($id: String!, $resolverId: String!) {
|
|
379
381
|
domain(id: $id) {
|
|
382
|
+
name
|
|
380
383
|
isMigrated
|
|
381
384
|
createdAt
|
|
382
385
|
}
|
|
@@ -414,11 +417,12 @@ const graphFetch = async (
|
|
|
414
417
|
|
|
415
418
|
if (!domain) return
|
|
416
419
|
|
|
417
|
-
const { isMigrated, createdAt } = domain
|
|
420
|
+
const { isMigrated, createdAt, name: decryptedName } = domain
|
|
418
421
|
|
|
419
422
|
const returnedRecords: ProfileResponse = {}
|
|
420
423
|
|
|
421
|
-
if (!resolverResponse || !wantedRecords)
|
|
424
|
+
if (!resolverResponse || !wantedRecords)
|
|
425
|
+
return { isMigrated, createdAt, decryptedName }
|
|
422
426
|
|
|
423
427
|
Object.keys(wantedRecords).forEach((key: string) => {
|
|
424
428
|
const data = wantedRecords[key as keyof ProfileOptions]
|
|
@@ -433,6 +437,7 @@ const graphFetch = async (
|
|
|
433
437
|
|
|
434
438
|
return {
|
|
435
439
|
...returnedRecords,
|
|
440
|
+
decryptedName,
|
|
436
441
|
isMigrated,
|
|
437
442
|
createdAt,
|
|
438
443
|
}
|
|
@@ -486,6 +491,7 @@ const getProfileFromName = async (
|
|
|
486
491
|
)
|
|
487
492
|
let isMigrated: boolean | null = null
|
|
488
493
|
let createdAt: string | null = null
|
|
494
|
+
let decryptedName: string | null = null
|
|
489
495
|
let result: Awaited<ReturnType<typeof getDataForName>> | null = null
|
|
490
496
|
if (!graphResult) {
|
|
491
497
|
if (!fallback) return
|
|
@@ -506,13 +512,16 @@ const getProfileFromName = async (
|
|
|
506
512
|
const {
|
|
507
513
|
isMigrated: _isMigrated,
|
|
508
514
|
createdAt: _createdAt,
|
|
515
|
+
decryptedName: _decryptedName,
|
|
509
516
|
...wantedRecords
|
|
510
517
|
}: {
|
|
511
518
|
isMigrated: boolean
|
|
512
519
|
createdAt: string
|
|
520
|
+
decryptedName: string
|
|
513
521
|
} & InternalProfileOptions = graphResult
|
|
514
522
|
isMigrated = _isMigrated
|
|
515
523
|
createdAt = _createdAt
|
|
524
|
+
decryptedName = _decryptedName
|
|
516
525
|
let recordsWithFallback = usingOptions
|
|
517
526
|
? wantedRecords
|
|
518
527
|
: (_options as InternalProfileOptions)
|
|
@@ -547,7 +556,7 @@ const getProfileFromName = async (
|
|
|
547
556
|
? "Records fetch didn't complete"
|
|
548
557
|
: "Name doesn't have a resolver",
|
|
549
558
|
}
|
|
550
|
-
return { ...result, isMigrated, createdAt, message: undefined }
|
|
559
|
+
return { ...result, isMigrated, createdAt, decryptedName, message: undefined }
|
|
551
560
|
}
|
|
552
561
|
|
|
553
562
|
const getProfileFromAddress = async (
|
|
@@ -52,13 +52,16 @@ describe('getWrapperData', () => {
|
|
|
52
52
|
expect(result.child.CANNOT_UNWRAP).toBe(true)
|
|
53
53
|
expect(result.child.CANNOT_CREATE_SUBDOMAIN).toBe(true)
|
|
54
54
|
expect(result.child.CANNOT_SET_TTL).toBe(true)
|
|
55
|
+
expect(result.parent.IS_DOT_ETH).toBe(true)
|
|
55
56
|
}
|
|
56
57
|
})
|
|
57
58
|
it('should return correct expiry', async () => {
|
|
58
59
|
const result = await ensInstance.getWrapperData('wrapped.eth')
|
|
59
60
|
expect(result).toBeTruthy()
|
|
60
61
|
if (result) {
|
|
62
|
+
console.log(result.expiryDate)
|
|
61
63
|
expect(result.expiryDate).toBeInstanceOf(Date)
|
|
64
|
+
expect(Number.isNaN(result.expiryDate?.getTime())).toBe(false)
|
|
62
65
|
}
|
|
63
66
|
})
|
|
64
67
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BigNumber } from '@ethersproject/bignumber
|
|
1
|
+
import { BigNumber } from '@ethersproject/bignumber'
|
|
2
2
|
import { ENSArgs } from '../index'
|
|
3
3
|
import { decodeFuses } from '../utils/fuses'
|
|
4
4
|
import { namehash } from '../utils/normalise'
|
|
@@ -23,7 +23,7 @@ const decode = async ({ contracts }: ENSArgs<'contracts'>, data: string) => {
|
|
|
23
23
|
|
|
24
24
|
const expiryDate =
|
|
25
25
|
expiry.gt(0) && expiry.lt(BigNumber.from(2).pow(32))
|
|
26
|
-
? new Date(expiry.mul(1000).
|
|
26
|
+
? new Date(expiry.mul(1000).toNumber())
|
|
27
27
|
: undefined
|
|
28
28
|
|
|
29
29
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BigNumber, BigNumberish } from '@ethersproject/bignumber
|
|
1
|
+
import { BigNumber, BigNumberish } from '@ethersproject/bignumber'
|
|
2
2
|
import { ENSArgs } from '..'
|
|
3
3
|
import { MAX_INT_64 } from '../utils/consts'
|
|
4
4
|
import { labelhash } from '../utils/labels'
|
package/src/functions/types.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type commitName from './commitName'
|
|
|
8
8
|
import type createSubname from './createSubname'
|
|
9
9
|
import type deleteSubname from './deleteSubname'
|
|
10
10
|
import type getAvailable from './getAvailable'
|
|
11
|
+
import type getDecryptedName from './getDecryptedName'
|
|
11
12
|
import type getDNSOwner from './getDNSOwner'
|
|
12
13
|
import type getExpiry from './getExpiry'
|
|
13
14
|
import type { getHistory } from './getHistory'
|
|
@@ -61,6 +62,7 @@ type Function = {
|
|
|
61
62
|
createSubname: typeof createSubname
|
|
62
63
|
deleteSubname: typeof deleteSubname
|
|
63
64
|
getAvailable: typeof getAvailable
|
|
65
|
+
getDecryptedName: typeof getDecryptedName
|
|
64
66
|
getDNSOwner: typeof getDNSOwner
|
|
65
67
|
getExpiry: typeof getExpiry
|
|
66
68
|
getHistory: typeof getHistory
|
|
@@ -2,6 +2,7 @@ import { keccak256 as solidityKeccak256 } from '@ethersproject/solidity'
|
|
|
2
2
|
|
|
3
3
|
import { ENSArgs } from '..'
|
|
4
4
|
import { namehash } from '../utils/normalise'
|
|
5
|
+
import { checkIsDotEth } from '../utils/validation'
|
|
5
6
|
|
|
6
7
|
export default async function (
|
|
7
8
|
{ contracts, signer }: ENSArgs<'contracts' | 'signer'>,
|
|
@@ -20,7 +21,7 @@ export default async function (
|
|
|
20
21
|
|
|
21
22
|
const nameWrapper = (await contracts!.getNameWrapper()!).connect(signer)
|
|
22
23
|
|
|
23
|
-
if (labels
|
|
24
|
+
if (checkIsDotEth(labels)) {
|
|
24
25
|
if (!newRegistrant) {
|
|
25
26
|
throw new Error('newRegistrant must be specified for .eth names')
|
|
26
27
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { defaultAbiCoder } from '@ethersproject/abi
|
|
1
|
+
import { defaultAbiCoder } from '@ethersproject/abi'
|
|
2
2
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
3
3
|
import { keccak256 as solidityKeccak256 } from '@ethersproject/solidity'
|
|
4
4
|
import { ENSArgs } from '..'
|
|
5
5
|
import { CombinedFuseInput, encodeFuses } from '../utils/fuses'
|
|
6
6
|
import { hexEncodeName } from '../utils/hexEncodedName'
|
|
7
|
+
import { checkIsDotEth } from '../utils/validation'
|
|
7
8
|
import { Expiry, wrappedLabelLengthCheck } from '../utils/wrapper'
|
|
8
9
|
|
|
9
10
|
async function wrapETH(
|
|
@@ -84,7 +85,7 @@ export default async function (
|
|
|
84
85
|
const labels = name.split('.')
|
|
85
86
|
wrappedLabelLengthCheck(labels[0])
|
|
86
87
|
|
|
87
|
-
if (labels
|
|
88
|
+
if (checkIsDotEth(labels)) {
|
|
88
89
|
switch (typeof fuseOptions) {
|
|
89
90
|
case 'object': {
|
|
90
91
|
decodedFuses = encodeFuses(fuseOptions)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import { Interface } from '@ethersproject/abi
|
|
5
|
+
import { Interface } from '@ethersproject/abi'
|
|
6
6
|
import { Signer } from '@ethersproject/abstract-signer'
|
|
7
7
|
import { Contract } from '@ethersproject/contracts'
|
|
8
8
|
import type { Provider } from '@ethersproject/providers'
|
package/src/index.ts
CHANGED
|
@@ -548,6 +548,10 @@ export class ENS {
|
|
|
548
548
|
['contracts'],
|
|
549
549
|
)
|
|
550
550
|
|
|
551
|
+
public getDecryptedName = this.generateRawFunction<
|
|
552
|
+
FunctionTypes['getDecryptedName']
|
|
553
|
+
>('getDecryptedName', ['contracts', 'gqlInstance'])
|
|
554
|
+
|
|
551
555
|
public universalWrapper = this.generateRawFunction<
|
|
552
556
|
FunctionTypes['universalWrapper']
|
|
553
557
|
>('initialGetters', ['contracts'], 'universalWrapper')
|
|
@@ -558,7 +562,7 @@ export class ENS {
|
|
|
558
562
|
|
|
559
563
|
public multicallWrapper = this.generateRawFunction<
|
|
560
564
|
FunctionTypes['multicallWrapper']
|
|
561
|
-
>('initialGetters', ['contracts'], 'multicallWrapper')
|
|
565
|
+
>('initialGetters', ['contracts', 'provider'], 'multicallWrapper')
|
|
562
566
|
|
|
563
567
|
public setName = this.generateWriteFunction<FunctionTypes['setName']>(
|
|
564
568
|
'setName',
|
package/src/static.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StaticJsonRpcProvider } from '@ethersproject/providers
|
|
1
|
+
import type { StaticJsonRpcProvider } from '@ethersproject/providers'
|
|
2
2
|
import { gql, GraphQLClient } from 'graphql-request'
|
|
3
3
|
import { parse, print, visit } from 'graphql/language'
|
|
4
4
|
import traverse from 'traverse'
|
package/src/utils/ccip.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BigNumber } from '@ethersproject/bignumber
|
|
1
|
+
import { BigNumber } from '@ethersproject/bignumber'
|
|
2
2
|
import {
|
|
3
3
|
arrayify,
|
|
4
4
|
BytesLike,
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
hexDataSlice,
|
|
7
7
|
} from '@ethersproject/bytes'
|
|
8
8
|
import type { BaseProvider, TransactionRequest } from '@ethersproject/providers'
|
|
9
|
-
import { toUtf8String } from '@ethersproject/strings
|
|
9
|
+
import { toUtf8String } from '@ethersproject/strings'
|
|
10
10
|
import type { Transaction } from '@ethersproject/transactions'
|
|
11
11
|
|
|
12
12
|
function bytesPad(value: Uint8Array): Uint8Array {
|
|
@@ -133,7 +133,7 @@ const ccipLookup = async (
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
const tx = {
|
|
136
|
-
to:
|
|
136
|
+
to: txSender,
|
|
137
137
|
data: hexConcat([
|
|
138
138
|
callbackSelector,
|
|
139
139
|
encodeBytes([ccipResult, extraData!]),
|
package/src/utils/fuses.ts
CHANGED
|
@@ -45,6 +45,7 @@ export const userSettableFuseEnum = {
|
|
|
45
45
|
|
|
46
46
|
export const fullFuseEnum = {
|
|
47
47
|
...userSettableFuseEnum,
|
|
48
|
+
...fullParentFuseEnum,
|
|
48
49
|
CAN_DO_EVERYTHING,
|
|
49
50
|
}
|
|
50
51
|
|
|
@@ -303,9 +304,8 @@ const decodeNamedFuses = (fuses: number, arr: readonly string[]) => {
|
|
|
303
304
|
const fuseObj = Object.fromEntries(
|
|
304
305
|
arr.map((fuse) => [
|
|
305
306
|
fuse,
|
|
306
|
-
(fuses &
|
|
307
|
-
|
|
308
|
-
0,
|
|
307
|
+
(fuses & fullFuseEnum[fuse as keyof typeof fullFuseEnum]) ===
|
|
308
|
+
fullFuseEnum[fuse as keyof typeof fullFuseEnum],
|
|
309
309
|
]),
|
|
310
310
|
)
|
|
311
311
|
|
|
@@ -314,7 +314,7 @@ const decodeNamedFuses = (fuses: number, arr: readonly string[]) => {
|
|
|
314
314
|
|
|
315
315
|
const decodeUnnamedFuses = (fuses: number, arr: readonly number[]) => {
|
|
316
316
|
const fuseObj = Object.fromEntries(
|
|
317
|
-
arr.map((fuse) => [fuse, (fuses & fuse)
|
|
317
|
+
arr.map((fuse) => [fuse, (fuses & fuse) === fuse]),
|
|
318
318
|
)
|
|
319
319
|
|
|
320
320
|
return fuseObj
|
package/src/utils/labels.ts
CHANGED
|
@@ -64,21 +64,19 @@ export function saveLabel(label: string) {
|
|
|
64
64
|
|
|
65
65
|
export function saveName(name: string) {
|
|
66
66
|
const nameArray = name.split('.')
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
for (const label of nameArray) {
|
|
68
|
+
if (!isEncodedLabelhash(label)) {
|
|
69
|
+
saveLabel(label)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
70
72
|
}
|
|
71
73
|
|
|
72
|
-
|
|
73
|
-
export function checkLabel(hash: string): string | undefined {
|
|
74
|
+
export function checkLabel(hash: string): string {
|
|
74
75
|
const labels = getLabels()
|
|
75
76
|
if (isEncodedLabelhash(hash)) {
|
|
76
|
-
return labels[decodeLabelhash(hash)]
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (hash.startsWith('0x')) {
|
|
80
|
-
return labels[`${hash.slice(2)}`]
|
|
77
|
+
return labels[decodeLabelhash(hash)] || hash
|
|
81
78
|
}
|
|
79
|
+
return hash
|
|
82
80
|
}
|
|
83
81
|
|
|
84
82
|
export function encodeLabel(label: any) {
|
|
@@ -101,7 +99,7 @@ export function checkIsDecrypted(string: string | string[]) {
|
|
|
101
99
|
export function decryptName(name: string) {
|
|
102
100
|
return name
|
|
103
101
|
.split('.')
|
|
104
|
-
.map((label: any) => checkLabel(label)
|
|
102
|
+
.map((label: any) => checkLabel(label))
|
|
105
103
|
.join('.')
|
|
106
104
|
}
|
|
107
105
|
|
|
@@ -119,3 +117,7 @@ export function checkLocalStorageSize() {
|
|
|
119
117
|
? `${3 + (allStrings.length * 16) / (8 * 1024)} KB`
|
|
120
118
|
: 'Empty (0 KB)'
|
|
121
119
|
}
|
|
120
|
+
|
|
121
|
+
const encodedLabelRegex = /\[[a-fA-F0-9]{64}\]/g
|
|
122
|
+
export const getEncryptedLabelAmount = (name: string) =>
|
|
123
|
+
name.match(encodedLabelRegex)?.length || 0
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defaultAbiCoder } from '@ethersproject/abi
|
|
1
|
+
import { defaultAbiCoder } from '@ethersproject/abi'
|
|
2
2
|
import { keccak256 } from '@ethersproject/keccak256'
|
|
3
3
|
import type { PublicResolver } from '../generated'
|
|
4
4
|
import { CombinedFuseInput, encodeFuses, hasFuses } from './fuses'
|
package/src/utils/singleCall.ts
CHANGED
|
@@ -4,13 +4,18 @@ export default async (
|
|
|
4
4
|
provider: Provider,
|
|
5
5
|
ensData: any,
|
|
6
6
|
func: {
|
|
7
|
-
raw: (
|
|
7
|
+
raw: (
|
|
8
|
+
...args: any[]
|
|
9
|
+
) => Promise<{ to: string; data: string; passthrough?: any }>
|
|
8
10
|
decode: (...args: any[]) => Promise<any>
|
|
9
11
|
},
|
|
10
12
|
...data: any[]
|
|
11
|
-
) =>
|
|
12
|
-
func
|
|
13
|
-
|
|
14
|
-
.
|
|
13
|
+
) => {
|
|
14
|
+
const { passthrough, ...rawData } = await func.raw(ensData, ...data)
|
|
15
|
+
const result = await provider
|
|
16
|
+
.call({ ...rawData, ccipReadEnabled: true })
|
|
15
17
|
.catch(() => null)
|
|
16
|
-
|
|
18
|
+
if (!result) return
|
|
19
|
+
if (passthrough) return func.decode(ensData, result, passthrough, ...data)
|
|
20
|
+
return func.decode(ensData, result, ...data)
|
|
21
|
+
}
|
package/src/utils/validation.ts
CHANGED
package/src/utils/wrapper.ts
CHANGED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import dotenv from 'dotenv'
|
|
2
|
-
import { ENS } from '..'
|
|
3
|
-
import setup from '../tests/setup'
|
|
4
|
-
|
|
5
|
-
dotenv.config()
|
|
6
|
-
|
|
7
|
-
let ensInstance: ENS
|
|
8
|
-
|
|
9
|
-
beforeAll(async () => {
|
|
10
|
-
;({ ensInstance } = await setup(true))
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
jest.setTimeout(20000)
|
|
14
|
-
|
|
15
|
-
describe('getProfile', () => {
|
|
16
|
-
it('should return a profile from a ccip-read name', async () => {
|
|
17
|
-
const result = await ensInstance.getProfile('1.offchainexample.eth', {
|
|
18
|
-
fallback: {
|
|
19
|
-
texts: ['email', 'description'],
|
|
20
|
-
contentHash: true,
|
|
21
|
-
coinTypes: ['0', '60'],
|
|
22
|
-
},
|
|
23
|
-
})
|
|
24
|
-
expect(result).toBeTruthy()
|
|
25
|
-
if (result) {
|
|
26
|
-
expect(result.address).toBe('0x41563129cDbbD0c5D3e1c86cf9563926b243834d')
|
|
27
|
-
}
|
|
28
|
-
})
|
|
29
|
-
})
|