@ensdomains/ensjs 3.0.0-beta.1 → 3.0.0-beta.11
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/contracts/OldestResolver.json +170 -0
- package/contracts/UniversalResolverv2.json +628 -0
- package/dist/cjs/clients/decorators/subgraph.js.map +1 -1
- package/dist/cjs/clients/decorators/wallet.js +2 -0
- package/dist/cjs/clients/decorators/wallet.js.map +1 -1
- package/dist/cjs/clients/public.js.map +1 -1
- package/dist/cjs/clients/subgraph.js.map +1 -1
- package/dist/cjs/contracts/consts.js +53 -2
- package/dist/cjs/contracts/consts.js.map +1 -1
- package/dist/cjs/contracts/universalResolver.js +46 -1
- package/dist/cjs/contracts/universalResolver.js.map +1 -1
- package/dist/cjs/dns.js +3 -3
- package/dist/cjs/dns.js.map +1 -1
- package/dist/cjs/errors/subgraph.js.map +1 -1
- package/dist/cjs/errors/utils.js +27 -18
- package/dist/cjs/errors/utils.js.map +1 -1
- package/dist/cjs/errors/version.js +1 -1
- package/dist/cjs/errors/version.js.map +1 -1
- package/dist/cjs/functions/dns/{prepareDnsImport.js → getDnsImportData.js} +3 -3
- package/dist/cjs/functions/dns/{prepareDnsImport.js.map → getDnsImportData.js.map} +1 -1
- package/dist/cjs/functions/dns/importDnsName.js +7 -7
- package/dist/cjs/functions/dns/importDnsName.js.map +1 -1
- package/dist/cjs/functions/public/_getAbi.js +2 -2
- package/dist/cjs/functions/public/_getAbi.js.map +1 -1
- package/dist/cjs/functions/public/_getAddr.js +9 -19
- package/dist/cjs/functions/public/_getAddr.js.map +1 -1
- package/dist/cjs/functions/public/_getContentHash.js +1 -1
- package/dist/cjs/functions/public/batch.js.map +1 -1
- package/dist/cjs/functions/public/getAbiRecord.js.map +1 -1
- package/dist/cjs/functions/public/getAddressRecord.js.map +1 -1
- package/dist/cjs/functions/public/getAvailable.js.map +1 -1
- package/dist/cjs/functions/public/getContentHashRecord.js.map +1 -1
- package/dist/cjs/functions/public/getExpiry.js.map +1 -1
- package/dist/cjs/functions/public/getName.js.map +1 -1
- package/dist/cjs/functions/public/getOwner.js.map +1 -1
- package/dist/cjs/functions/public/getPrice.js.map +1 -1
- package/dist/cjs/functions/public/getRecords.js +56 -42
- package/dist/cjs/functions/public/getRecords.js.map +1 -1
- package/dist/cjs/functions/public/getResolver.js.map +1 -1
- package/dist/cjs/functions/public/getSupportedInterfaces.js +1 -1
- package/dist/cjs/functions/public/getSupportedInterfaces.js.map +1 -1
- package/dist/cjs/functions/public/getTextRecord.js.map +1 -1
- package/dist/cjs/functions/public/getWrapperData.js.map +1 -1
- package/dist/cjs/functions/public/getWrapperName.js.map +1 -1
- package/dist/cjs/functions/public/multicallWrapper.js.map +1 -1
- package/dist/cjs/functions/public/universalWrapper.js.map +1 -1
- package/dist/cjs/functions/subgraph/client.js.map +1 -1
- package/dist/cjs/functions/subgraph/filters.js +3 -0
- package/dist/cjs/functions/subgraph/filters.js.map +1 -0
- package/dist/cjs/functions/subgraph/getDecodedName.js.map +1 -1
- package/dist/cjs/functions/subgraph/getNameHistory.js +4 -3
- package/dist/cjs/functions/subgraph/getNameHistory.js.map +1 -1
- package/dist/cjs/functions/subgraph/getNamesForAddress.js +155 -190
- package/dist/cjs/functions/subgraph/getNamesForAddress.js.map +1 -1
- package/dist/cjs/functions/subgraph/getSubgraphRecords.js +34 -26
- package/dist/cjs/functions/subgraph/getSubgraphRecords.js.map +1 -1
- package/dist/cjs/functions/subgraph/getSubgraphRegistrant.js.map +1 -1
- package/dist/cjs/functions/subgraph/getSubnames.js +95 -108
- package/dist/cjs/functions/subgraph/getSubnames.js.map +1 -1
- package/dist/cjs/functions/subgraph/types.js +3 -0
- package/dist/cjs/functions/subgraph/types.js.map +1 -0
- package/dist/cjs/functions/subgraph/utils.js.map +1 -1
- package/dist/cjs/functions/wallet/clearRecords.js +26 -0
- package/dist/cjs/functions/wallet/clearRecords.js.map +1 -0
- package/dist/cjs/functions/wallet/commitName.js.map +1 -1
- package/dist/cjs/functions/wallet/createSubname.js +1 -1
- package/dist/cjs/functions/wallet/createSubname.js.map +1 -1
- package/dist/cjs/functions/wallet/deleteSubname.js.map +1 -1
- package/dist/cjs/functions/wallet/registerName.js.map +1 -1
- package/dist/cjs/functions/wallet/renewNames.js.map +1 -1
- package/dist/cjs/functions/wallet/setAbiRecord.js.map +1 -1
- package/dist/cjs/functions/wallet/setAddressRecord.js.map +1 -1
- package/dist/cjs/functions/wallet/setChildFuses.js +1 -1
- package/dist/cjs/functions/wallet/setChildFuses.js.map +1 -1
- package/dist/cjs/functions/wallet/setContentHashRecord.js.map +1 -1
- package/dist/cjs/functions/wallet/setFuses.js +1 -1
- package/dist/cjs/functions/wallet/setFuses.js.map +1 -1
- package/dist/cjs/functions/wallet/setPrimaryName.js.map +1 -1
- package/dist/cjs/functions/wallet/setRecords.js.map +1 -1
- package/dist/cjs/functions/wallet/setResolver.js.map +1 -1
- package/dist/cjs/functions/wallet/setTextRecord.js.map +1 -1
- package/dist/cjs/functions/wallet/transferName.js.map +1 -1
- package/dist/cjs/functions/wallet/unwrapName.js.map +1 -1
- package/dist/cjs/functions/wallet/wrapName.js +3 -1
- package/dist/cjs/functions/wallet/wrapName.js.map +1 -1
- package/dist/cjs/index.js +1 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/subgraph.js +4 -1
- package/dist/cjs/subgraph.js.map +1 -1
- package/dist/cjs/utils/contentHash.js +60 -131
- package/dist/cjs/utils/contentHash.js.map +1 -1
- package/dist/cjs/utils/encoders/encodeAbi.js +33 -3
- package/dist/cjs/utils/encoders/encodeAbi.js.map +1 -1
- package/dist/cjs/utils/encoders/encodeClearRecords.js +12 -0
- package/dist/cjs/utils/encoders/encodeClearRecords.js.map +1 -0
- package/dist/cjs/utils/encoders/encodeSetAddr.js +5 -16
- package/dist/cjs/utils/encoders/encodeSetAddr.js.map +1 -1
- package/dist/cjs/utils/encoders/encodeSetContentHash.js +1 -4
- package/dist/cjs/utils/encoders/encodeSetContentHash.js.map +1 -1
- package/dist/cjs/utils/format.js +1 -5
- package/dist/cjs/utils/format.js.map +1 -1
- package/dist/cjs/utils/fuses.js +184 -200
- package/dist/cjs/utils/fuses.js.map +1 -1
- package/dist/cjs/utils/generateRecordCallArray.js +6 -10
- package/dist/cjs/utils/generateRecordCallArray.js.map +1 -1
- package/dist/cjs/utils/getRevertErrorData.js +4 -1
- package/dist/cjs/utils/getRevertErrorData.js.map +1 -1
- package/dist/cjs/utils/index.js +31 -7
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/normaliseCoinId.js +35 -0
- package/dist/cjs/utils/normaliseCoinId.js.map +1 -0
- package/dist/cjs/utils/registerHelpers.js +3 -1
- package/dist/cjs/utils/registerHelpers.js.map +1 -1
- package/dist/cjs/wallet.js +3 -1
- package/dist/cjs/wallet.js.map +1 -1
- package/dist/esm/clients/decorators/subgraph.js.map +1 -1
- package/dist/esm/clients/decorators/wallet.js +2 -0
- package/dist/esm/clients/decorators/wallet.js.map +1 -1
- package/dist/esm/clients/public.js.map +1 -1
- package/dist/esm/clients/subgraph.js.map +1 -1
- package/dist/esm/contracts/consts.js +53 -2
- package/dist/esm/contracts/consts.js.map +1 -1
- package/dist/esm/contracts/universalResolver.js +46 -1
- package/dist/esm/contracts/universalResolver.js.map +1 -1
- package/dist/esm/dns.js +1 -1
- package/dist/esm/dns.js.map +1 -1
- package/dist/esm/errors/subgraph.js.map +1 -1
- package/dist/esm/errors/utils.js +24 -16
- package/dist/esm/errors/utils.js.map +1 -1
- package/dist/esm/errors/version.js +1 -1
- package/dist/esm/errors/version.js.map +1 -1
- package/dist/esm/functions/dns/{prepareDnsImport.js → getDnsImportData.js} +10 -10
- package/dist/esm/functions/dns/{prepareDnsImport.js.map → getDnsImportData.js.map} +1 -1
- package/dist/esm/functions/dns/getDnsOwner.js +1 -1
- package/dist/esm/functions/dns/importDnsName.js +13 -12
- package/dist/esm/functions/dns/importDnsName.js.map +1 -1
- package/dist/esm/functions/public/_getAbi.js +2 -2
- package/dist/esm/functions/public/_getAbi.js.map +1 -1
- package/dist/esm/functions/public/_getAddr.js +10 -20
- package/dist/esm/functions/public/_getAddr.js.map +1 -1
- package/dist/esm/functions/public/_getContentHash.js +2 -2
- package/dist/esm/functions/public/batch.js +2 -1
- package/dist/esm/functions/public/batch.js.map +1 -1
- package/dist/esm/functions/public/getAbiRecord.js +2 -1
- package/dist/esm/functions/public/getAbiRecord.js.map +1 -1
- package/dist/esm/functions/public/getAddressRecord.js +2 -1
- package/dist/esm/functions/public/getAddressRecord.js.map +1 -1
- package/dist/esm/functions/public/getAvailable.js +2 -1
- package/dist/esm/functions/public/getAvailable.js.map +1 -1
- package/dist/esm/functions/public/getContentHashRecord.js +2 -1
- package/dist/esm/functions/public/getContentHashRecord.js.map +1 -1
- package/dist/esm/functions/public/getExpiry.js +2 -1
- package/dist/esm/functions/public/getExpiry.js.map +1 -1
- package/dist/esm/functions/public/getName.js +2 -1
- package/dist/esm/functions/public/getName.js.map +1 -1
- package/dist/esm/functions/public/getOwner.js +3 -2
- package/dist/esm/functions/public/getOwner.js.map +1 -1
- package/dist/esm/functions/public/getPrice.js +3 -2
- package/dist/esm/functions/public/getPrice.js.map +1 -1
- package/dist/esm/functions/public/getRecords.js +59 -48
- package/dist/esm/functions/public/getRecords.js.map +1 -1
- package/dist/esm/functions/public/getResolver.js +2 -1
- package/dist/esm/functions/public/getResolver.js.map +1 -1
- package/dist/esm/functions/public/getSupportedInterfaces.js +24 -2
- package/dist/esm/functions/public/getSupportedInterfaces.js.map +1 -1
- package/dist/esm/functions/public/getTextRecord.js +2 -1
- package/dist/esm/functions/public/getTextRecord.js.map +1 -1
- package/dist/esm/functions/public/getWrapperData.js +2 -1
- package/dist/esm/functions/public/getWrapperData.js.map +1 -1
- package/dist/esm/functions/public/getWrapperName.js +2 -1
- package/dist/esm/functions/public/getWrapperName.js.map +1 -1
- package/dist/esm/functions/public/multicallWrapper.js.map +1 -1
- package/dist/esm/functions/public/universalWrapper.js.map +1 -1
- package/dist/esm/functions/subgraph/client.js.map +1 -1
- package/dist/esm/functions/subgraph/filters.js +2 -0
- package/dist/esm/functions/subgraph/filters.js.map +1 -0
- package/dist/esm/functions/subgraph/getDecodedName.js +2 -1
- package/dist/esm/functions/subgraph/getDecodedName.js.map +1 -1
- package/dist/esm/functions/subgraph/getNameHistory.js +8 -6
- package/dist/esm/functions/subgraph/getNameHistory.js.map +1 -1
- package/dist/esm/functions/subgraph/getNamesForAddress.js +163 -192
- package/dist/esm/functions/subgraph/getNamesForAddress.js.map +1 -1
- package/dist/esm/functions/subgraph/getSubgraphRecords.js +36 -27
- package/dist/esm/functions/subgraph/getSubgraphRecords.js.map +1 -1
- package/dist/esm/functions/subgraph/getSubgraphRegistrant.js +2 -1
- package/dist/esm/functions/subgraph/getSubgraphRegistrant.js.map +1 -1
- package/dist/esm/functions/subgraph/getSubnames.js +103 -112
- package/dist/esm/functions/subgraph/getSubnames.js.map +1 -1
- package/dist/esm/functions/subgraph/types.js +2 -0
- package/dist/esm/functions/subgraph/types.js.map +1 -0
- package/dist/esm/functions/subgraph/utils.js.map +1 -1
- package/dist/esm/functions/wallet/clearRecords.js +44 -0
- package/dist/esm/functions/wallet/clearRecords.js.map +1 -0
- package/dist/esm/functions/wallet/commitName.js +3 -1
- package/dist/esm/functions/wallet/commitName.js.map +1 -1
- package/dist/esm/functions/wallet/createSubname.js +3 -2
- package/dist/esm/functions/wallet/createSubname.js.map +1 -1
- package/dist/esm/functions/wallet/deleteSubname.js +2 -1
- package/dist/esm/functions/wallet/deleteSubname.js.map +1 -1
- package/dist/esm/functions/wallet/registerName.js +4 -1
- package/dist/esm/functions/wallet/registerName.js.map +1 -1
- package/dist/esm/functions/wallet/renewNames.js +3 -1
- package/dist/esm/functions/wallet/renewNames.js.map +1 -1
- package/dist/esm/functions/wallet/setAbiRecord.js +3 -1
- package/dist/esm/functions/wallet/setAbiRecord.js.map +1 -1
- package/dist/esm/functions/wallet/setAddressRecord.js +2 -1
- package/dist/esm/functions/wallet/setAddressRecord.js.map +1 -1
- package/dist/esm/functions/wallet/setChildFuses.js +3 -2
- package/dist/esm/functions/wallet/setChildFuses.js.map +1 -1
- package/dist/esm/functions/wallet/setContentHashRecord.js +2 -1
- package/dist/esm/functions/wallet/setContentHashRecord.js.map +1 -1
- package/dist/esm/functions/wallet/setFuses.js +4 -3
- package/dist/esm/functions/wallet/setFuses.js.map +1 -1
- package/dist/esm/functions/wallet/setPrimaryName.js +2 -1
- package/dist/esm/functions/wallet/setPrimaryName.js.map +1 -1
- package/dist/esm/functions/wallet/setRecords.js +2 -1
- package/dist/esm/functions/wallet/setRecords.js.map +1 -1
- package/dist/esm/functions/wallet/setResolver.js +2 -1
- package/dist/esm/functions/wallet/setResolver.js.map +1 -1
- package/dist/esm/functions/wallet/setTextRecord.js +2 -1
- package/dist/esm/functions/wallet/setTextRecord.js.map +1 -1
- package/dist/esm/functions/wallet/transferName.js +2 -1
- package/dist/esm/functions/wallet/transferName.js.map +1 -1
- package/dist/esm/functions/wallet/unwrapName.js +2 -1
- package/dist/esm/functions/wallet/unwrapName.js.map +1 -1
- package/dist/esm/functions/wallet/wrapName.js +6 -3
- package/dist/esm/functions/wallet/wrapName.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/subgraph.js +1 -0
- package/dist/esm/subgraph.js.map +1 -1
- package/dist/esm/utils/contentHash.js +56 -128
- package/dist/esm/utils/contentHash.js.map +1 -1
- package/dist/esm/utils/encoders/encodeAbi.js +30 -2
- package/dist/esm/utils/encoders/encodeAbi.js.map +1 -1
- package/dist/esm/utils/encoders/encodeClearRecords.js +8 -0
- package/dist/esm/utils/encoders/encodeClearRecords.js.map +1 -0
- package/dist/esm/utils/encoders/encodeSetAddr.js +5 -16
- package/dist/esm/utils/encoders/encodeSetAddr.js.map +1 -1
- package/dist/esm/utils/encoders/encodeSetContentHash.js +2 -5
- package/dist/esm/utils/encoders/encodeSetContentHash.js.map +1 -1
- package/dist/esm/utils/format.js +0 -2
- package/dist/esm/utils/format.js.map +1 -1
- package/dist/esm/utils/fuses.js +183 -201
- package/dist/esm/utils/fuses.js.map +1 -1
- package/dist/esm/utils/generateRecordCallArray.js +7 -10
- package/dist/esm/utils/generateRecordCallArray.js.map +1 -1
- package/dist/esm/utils/getRevertErrorData.js +4 -1
- package/dist/esm/utils/getRevertErrorData.js.map +1 -1
- package/dist/esm/utils/index.js +5 -3
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/normaliseCoinId.js +30 -0
- package/dist/esm/utils/normaliseCoinId.js.map +1 -0
- package/dist/esm/utils/registerHelpers.js +4 -2
- package/dist/esm/utils/registerHelpers.js.map +1 -1
- package/dist/esm/wallet.js +1 -0
- package/dist/esm/wallet.js.map +1 -1
- package/dist/types/clients/decorators/public.d.ts +1 -519
- package/dist/types/clients/decorators/public.d.ts.map +1 -1
- package/dist/types/clients/decorators/subgraph.d.ts +2 -520
- package/dist/types/clients/decorators/subgraph.d.ts.map +1 -1
- package/dist/types/clients/decorators/wallet.d.ts +66 -47
- package/dist/types/clients/decorators/wallet.d.ts.map +1 -1
- package/dist/types/clients/public.d.ts +24 -265
- package/dist/types/clients/public.d.ts.map +1 -1
- package/dist/types/clients/subgraph.d.ts +19 -260
- package/dist/types/clients/subgraph.d.ts.map +1 -1
- package/dist/types/clients/wallet.d.ts +60 -92
- package/dist/types/clients/wallet.d.ts.map +1 -1
- package/dist/types/contracts/consts.d.ts +52 -3
- package/dist/types/contracts/consts.d.ts.map +1 -1
- package/dist/types/contracts/universalResolver.d.ts +133 -1
- package/dist/types/contracts/universalResolver.d.ts.map +1 -1
- package/dist/types/dns.d.ts +2 -2
- package/dist/types/dns.d.ts.map +1 -1
- package/dist/types/errors/subgraph.d.ts +4 -4
- package/dist/types/errors/subgraph.d.ts.map +1 -1
- package/dist/types/errors/utils.d.ts +16 -13
- package/dist/types/errors/utils.d.ts.map +1 -1
- package/dist/types/errors/version.d.ts +1 -1
- package/dist/types/errors/version.d.ts.map +1 -1
- package/dist/types/functions/dns/getDnsImportData.d.ts +39 -0
- package/dist/types/functions/dns/{prepareDnsImport.d.ts.map → getDnsImportData.d.ts.map} +1 -1
- package/dist/types/functions/dns/getDnsOwner.d.ts +1 -1
- package/dist/types/functions/dns/importDnsName.d.ts +88 -102
- package/dist/types/functions/dns/importDnsName.d.ts.map +1 -1
- package/dist/types/functions/public/_getAddr.d.ts.map +1 -1
- package/dist/types/functions/public/batch.d.ts +2 -1
- package/dist/types/functions/public/batch.d.ts.map +1 -1
- package/dist/types/functions/public/getAbiRecord.d.ts +2 -1
- package/dist/types/functions/public/getAbiRecord.d.ts.map +1 -1
- package/dist/types/functions/public/getAddressRecord.d.ts +2 -1
- package/dist/types/functions/public/getAddressRecord.d.ts.map +1 -1
- package/dist/types/functions/public/getAvailable.d.ts +2 -1
- package/dist/types/functions/public/getAvailable.d.ts.map +1 -1
- package/dist/types/functions/public/getContentHashRecord.d.ts +2 -1
- package/dist/types/functions/public/getContentHashRecord.d.ts.map +1 -1
- package/dist/types/functions/public/getExpiry.d.ts +2 -1
- package/dist/types/functions/public/getExpiry.d.ts.map +1 -1
- package/dist/types/functions/public/getName.d.ts +2 -1
- package/dist/types/functions/public/getName.d.ts.map +1 -1
- package/dist/types/functions/public/getOwner.d.ts +19 -9
- package/dist/types/functions/public/getOwner.d.ts.map +1 -1
- package/dist/types/functions/public/getPrice.d.ts +3 -2
- package/dist/types/functions/public/getPrice.d.ts.map +1 -1
- package/dist/types/functions/public/getRecords.d.ts +3 -2
- package/dist/types/functions/public/getRecords.d.ts.map +1 -1
- package/dist/types/functions/public/getResolver.d.ts +2 -1
- package/dist/types/functions/public/getResolver.d.ts.map +1 -1
- package/dist/types/functions/public/getSupportedInterfaces.d.ts +41 -4
- package/dist/types/functions/public/getSupportedInterfaces.d.ts.map +1 -1
- package/dist/types/functions/public/getTextRecord.d.ts +2 -1
- package/dist/types/functions/public/getTextRecord.d.ts.map +1 -1
- package/dist/types/functions/public/getWrapperData.d.ts +4 -3
- package/dist/types/functions/public/getWrapperData.d.ts.map +1 -1
- package/dist/types/functions/public/getWrapperName.d.ts +2 -1
- package/dist/types/functions/public/getWrapperName.d.ts.map +1 -1
- package/dist/types/functions/subgraph/client.d.ts +2 -2
- package/dist/types/functions/subgraph/client.d.ts.map +1 -1
- package/dist/types/functions/subgraph/filters.d.ts +693 -0
- package/dist/types/functions/subgraph/filters.d.ts.map +1 -0
- package/dist/types/functions/subgraph/getDecodedName.d.ts +2 -1
- package/dist/types/functions/subgraph/getDecodedName.d.ts.map +1 -1
- package/dist/types/functions/subgraph/getNameHistory.d.ts +2 -1
- package/dist/types/functions/subgraph/getNameHistory.d.ts.map +1 -1
- package/dist/types/functions/subgraph/getNamesForAddress.d.ts +7 -2
- package/dist/types/functions/subgraph/getNamesForAddress.d.ts.map +1 -1
- package/dist/types/functions/subgraph/getSubgraphRecords.d.ts +2 -1
- package/dist/types/functions/subgraph/getSubgraphRecords.d.ts.map +1 -1
- package/dist/types/functions/subgraph/getSubgraphRegistrant.d.ts +2 -1
- package/dist/types/functions/subgraph/getSubgraphRegistrant.d.ts.map +1 -1
- package/dist/types/functions/subgraph/getSubnames.d.ts +5 -2
- package/dist/types/functions/subgraph/getSubnames.d.ts.map +1 -1
- package/dist/types/functions/subgraph/types.d.ts +13 -0
- package/dist/types/functions/subgraph/types.d.ts.map +1 -0
- package/dist/types/functions/subgraph/utils.d.ts +2 -2
- package/dist/types/functions/subgraph/utils.d.ts.map +1 -1
- package/dist/types/functions/wallet/clearRecords.d.ts +555 -0
- package/dist/types/functions/wallet/clearRecords.d.ts.map +1 -0
- package/dist/types/functions/wallet/commitName.d.ts +80 -93
- package/dist/types/functions/wallet/commitName.d.ts.map +1 -1
- package/dist/types/functions/wallet/createSubname.d.ts +82 -96
- package/dist/types/functions/wallet/createSubname.d.ts.map +1 -1
- package/dist/types/functions/wallet/deleteSubname.d.ts +79 -93
- package/dist/types/functions/wallet/deleteSubname.d.ts.map +1 -1
- package/dist/types/functions/wallet/registerName.d.ts +80 -89
- package/dist/types/functions/wallet/registerName.d.ts.map +1 -1
- package/dist/types/functions/wallet/renewNames.d.ts +79 -89
- package/dist/types/functions/wallet/renewNames.d.ts.map +1 -1
- package/dist/types/functions/wallet/setAbiRecord.d.ts +80 -93
- package/dist/types/functions/wallet/setAbiRecord.d.ts.map +1 -1
- package/dist/types/functions/wallet/setAddressRecord.d.ts +79 -93
- package/dist/types/functions/wallet/setAddressRecord.d.ts.map +1 -1
- package/dist/types/functions/wallet/setChildFuses.d.ts +81 -95
- package/dist/types/functions/wallet/setChildFuses.d.ts.map +1 -1
- package/dist/types/functions/wallet/setContentHashRecord.d.ts +79 -93
- package/dist/types/functions/wallet/setContentHashRecord.d.ts.map +1 -1
- package/dist/types/functions/wallet/setFuses.d.ts +81 -95
- package/dist/types/functions/wallet/setFuses.d.ts.map +1 -1
- package/dist/types/functions/wallet/setPrimaryName.d.ts +79 -93
- package/dist/types/functions/wallet/setPrimaryName.d.ts.map +1 -1
- package/dist/types/functions/wallet/setRecords.d.ts +79 -93
- package/dist/types/functions/wallet/setRecords.d.ts.map +1 -1
- package/dist/types/functions/wallet/setResolver.d.ts +79 -93
- package/dist/types/functions/wallet/setResolver.d.ts.map +1 -1
- package/dist/types/functions/wallet/setTextRecord.d.ts +79 -93
- package/dist/types/functions/wallet/setTextRecord.d.ts.map +1 -1
- package/dist/types/functions/wallet/transferName.d.ts +80 -94
- package/dist/types/functions/wallet/transferName.d.ts.map +1 -1
- package/dist/types/functions/wallet/unwrapName.d.ts +79 -93
- package/dist/types/functions/wallet/unwrapName.d.ts.map +1 -1
- package/dist/types/functions/wallet/wrapName.d.ts +81 -95
- package/dist/types/functions/wallet/wrapName.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/subgraph.d.ts +1 -0
- package/dist/types/subgraph.d.ts.map +1 -1
- package/dist/types/types.d.ts +3 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/contentHash.d.ts +10 -11
- package/dist/types/utils/contentHash.d.ts.map +1 -1
- package/dist/types/utils/encoders/encodeAbi.d.ts +8 -5
- package/dist/types/utils/encoders/encodeAbi.d.ts.map +1 -1
- package/dist/types/utils/encoders/encodeClearRecords.d.ts +3 -0
- package/dist/types/utils/encoders/encodeClearRecords.d.ts.map +1 -0
- package/dist/types/utils/encoders/encodeSetAddr.d.ts.map +1 -1
- package/dist/types/utils/encoders/encodeSetContentHash.d.ts.map +1 -1
- package/dist/types/utils/format.d.ts +0 -2
- package/dist/types/utils/format.d.ts.map +1 -1
- package/dist/types/utils/fuses.d.ts +164 -125
- package/dist/types/utils/fuses.d.ts.map +1 -1
- package/dist/types/utils/generateRecordCallArray.d.ts +5 -5
- package/dist/types/utils/generateRecordCallArray.d.ts.map +1 -1
- package/dist/types/utils/getRevertErrorData.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +5 -3
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/normaliseCoinId.d.ts +10 -0
- package/dist/types/utils/normaliseCoinId.d.ts.map +1 -0
- package/dist/types/utils/registerHelpers.d.ts +2 -2
- package/dist/types/utils/registerHelpers.d.ts.map +1 -1
- package/dist/types/wallet.d.ts +18 -17
- package/dist/types/wallet.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/clients/decorators/subgraph.ts +1 -0
- package/src/clients/decorators/wallet.ts +41 -3
- package/src/clients/public.ts +3 -2
- package/src/clients/subgraph.ts +3 -2
- package/src/clients/wallet.ts +1 -1
- package/src/contracts/consts.ts +58 -13
- package/src/contracts/universalResolver.ts +46 -1
- package/src/dns.ts +7 -5
- package/src/errors/subgraph.ts +4 -4
- package/src/errors/utils.ts +29 -18
- package/src/errors/version.ts +1 -1
- package/src/functions/dns/{prepareDnsImport.ts → getDnsImportData.ts} +13 -13
- package/src/functions/dns/getDnsOwner.ts +1 -1
- package/src/functions/dns/importDnsName.ts +21 -15
- package/src/functions/public/_getAbi.ts +2 -2
- package/src/functions/public/_getAddr.ts +16 -23
- package/src/functions/public/_getContentHash.ts +2 -2
- package/src/functions/public/batch.ts +2 -1
- package/src/functions/public/getAbiRecord.ts +2 -1
- package/src/functions/public/getAddressRecord.ts +2 -1
- package/src/functions/public/getAvailable.ts +2 -1
- package/src/functions/public/getContentHashRecord.ts +2 -1
- package/src/functions/public/getExpiry.ts +2 -1
- package/src/functions/public/getName.ts +3 -2
- package/src/functions/public/getOwner.ts +54 -33
- package/src/functions/public/getPrice.ts +3 -2
- package/src/functions/public/getRecords.ts +130 -114
- package/src/functions/public/getResolver.ts +3 -2
- package/src/functions/public/getSupportedInterfaces.ts +70 -10
- package/src/functions/public/getTextRecord.ts +2 -1
- package/src/functions/public/getWrapperData.ts +5 -4
- package/src/functions/public/getWrapperName.ts +3 -2
- package/src/functions/public/multicallWrapper.ts +1 -1
- package/src/functions/public/universalWrapper.ts +1 -1
- package/src/functions/subgraph/client.ts +2 -2
- package/src/functions/subgraph/filters.ts +702 -0
- package/src/functions/subgraph/getDecodedName.ts +2 -1
- package/src/functions/subgraph/getNameHistory.ts +8 -6
- package/src/functions/subgraph/getNamesForAddress.ts +199 -195
- package/src/functions/subgraph/getSubgraphRecords.ts +65 -33
- package/src/functions/subgraph/getSubgraphRegistrant.ts +2 -1
- package/src/functions/subgraph/getSubnames.ts +123 -114
- package/src/functions/subgraph/types.ts +13 -0
- package/src/functions/subgraph/utils.ts +2 -2
- package/src/functions/wallet/clearRecords.ts +97 -0
- package/src/functions/wallet/commitName.ts +3 -1
- package/src/functions/wallet/createSubname.ts +6 -5
- package/src/functions/wallet/deleteSubname.ts +2 -1
- package/src/functions/wallet/registerName.ts +4 -1
- package/src/functions/wallet/renewNames.ts +3 -1
- package/src/functions/wallet/setAbiRecord.ts +3 -1
- package/src/functions/wallet/setAddressRecord.ts +2 -1
- package/src/functions/wallet/setChildFuses.ts +5 -4
- package/src/functions/wallet/setContentHashRecord.ts +2 -1
- package/src/functions/wallet/setFuses.ts +8 -4
- package/src/functions/wallet/setPrimaryName.ts +2 -1
- package/src/functions/wallet/setRecords.ts +2 -1
- package/src/functions/wallet/setResolver.ts +2 -1
- package/src/functions/wallet/setTextRecord.ts +2 -1
- package/src/functions/wallet/transferName.ts +3 -2
- package/src/functions/wallet/unwrapName.ts +2 -1
- package/src/functions/wallet/wrapName.ts +10 -4
- package/src/index.ts +0 -1
- package/src/subgraph.ts +5 -0
- package/src/types.ts +6 -3
- package/src/utils/contentHash.ts +65 -113
- package/src/utils/encoders/encodeAbi.ts +37 -8
- package/src/utils/encoders/encodeClearRecords.ts +9 -0
- package/src/utils/encoders/encodeSetAddr.ts +5 -16
- package/src/utils/encoders/encodeSetContentHash.ts +2 -4
- package/src/utils/format.ts +0 -6
- package/src/utils/fuses.ts +312 -308
- package/src/utils/generateRecordCallArray.ts +10 -14
- package/src/utils/getRevertErrorData.ts +3 -1
- package/src/utils/index.ts +37 -5
- package/src/utils/normaliseCoinId.ts +36 -0
- package/src/utils/registerHelpers.ts +5 -3
- package/src/wallet.ts +41 -0
- package/dist/types/functions/dns/prepareDnsImport.d.ts +0 -39
- package/src/@types/@ensdomains/content-hash.d.ts +0 -1
- package/src/functions/dns/getDnsOwner.test.ts +0 -195
- package/src/functions/dns/importDnsName.test.ts +0 -117
- package/src/functions/dns/prepareDnsImport.test.ts +0 -115
- package/src/functions/public/batch.test.ts +0 -67
- package/src/functions/public/ccip.test.ts +0 -78
- package/src/functions/public/getAbiRecord.test.ts +0 -174
- package/src/functions/public/getAddressRecord.test.ts +0 -83
- package/src/functions/public/getAvailable.test.ts +0 -17
- package/src/functions/public/getContentHashRecord.test.ts +0 -28
- package/src/functions/public/getExpiry.test.ts +0 -48
- package/src/functions/public/getName.test.ts +0 -66
- package/src/functions/public/getOwner.test.ts +0 -87
- package/src/functions/public/getPrice.test.ts +0 -45
- package/src/functions/public/getRecords.test.ts +0 -49
- package/src/functions/public/getResolver.test.ts +0 -12
- package/src/functions/public/getTextRecord.test.ts +0 -20
- package/src/functions/public/getWrapperData.test.ts +0 -79
- package/src/functions/public/getWrapperName.test.ts +0 -19
- package/src/functions/subgraph/client.test.ts +0 -170
- package/src/functions/subgraph/getDecodedName.test.ts +0 -31
- package/src/functions/subgraph/getNameHistory.test.ts +0 -39
- package/src/functions/subgraph/getNamesForAddress.test.ts +0 -244
- package/src/functions/subgraph/getSubgraphRecords.test.ts +0 -74
- package/src/functions/subgraph/getSubgraphRegistrant.test.ts +0 -34
- package/src/functions/subgraph/getSubnames.test.ts +0 -202
- package/src/functions/wallet/commitName.test.ts +0 -58
- package/src/functions/wallet/createSubname.test.ts +0 -73
- package/src/functions/wallet/deleteSubname.test.ts +0 -150
- package/src/functions/wallet/registerName.test.ts +0 -81
- package/src/functions/wallet/renewNames.test.ts +0 -92
- package/src/functions/wallet/setAbiRecord.test.ts +0 -156
- package/src/functions/wallet/setAddressRecord.test.ts +0 -121
- package/src/functions/wallet/setChildFuses.test.ts +0 -97
- package/src/functions/wallet/setContentHashRecord.test.ts +0 -69
- package/src/functions/wallet/setFuses.test.ts +0 -287
- package/src/functions/wallet/setPrimaryName.test.ts +0 -71
- package/src/functions/wallet/setRecords.test.ts +0 -127
- package/src/functions/wallet/setResolver.test.ts +0 -114
- package/src/functions/wallet/setTextRecord.test.ts +0 -67
- package/src/functions/wallet/transferName.test.ts +0 -201
- package/src/functions/wallet/unwrapName.test.ts +0 -93
- package/src/functions/wallet/wrapName.test.ts +0 -195
- package/src/utils/generateRecordCallArray.test.ts +0 -84
- package/src/utils/labels.test.ts +0 -163
- package/src/utils/makeLabelNodeAndParent.test.ts +0 -11
- package/src/utils/makeSafeSecondsDate.test.ts +0 -14
- package/src/utils/normalise.test.ts +0 -35
- package/src/utils/ownerFromContract.test.ts +0 -52
- package/src/utils/registerHelpers.test.ts +0 -159
- package/src/utils/validation.test.ts +0 -170
- package/src/utils/wrapper.test.ts +0 -46
package/src/utils/labels.test.ts
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { labelhash } from 'viem'
|
|
2
|
-
import { getVersion } from '../errors/error-utils.js'
|
|
3
|
-
import {
|
|
4
|
-
decodeLabelhash,
|
|
5
|
-
encodeLabelhash,
|
|
6
|
-
isEncodedLabelhash,
|
|
7
|
-
saveLabel,
|
|
8
|
-
saveName,
|
|
9
|
-
} from './labels.js'
|
|
10
|
-
|
|
11
|
-
describe('decodeLabelhash()', () => {
|
|
12
|
-
it('decodes labelhash', () => {
|
|
13
|
-
expect(
|
|
14
|
-
decodeLabelhash(
|
|
15
|
-
'[9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658]',
|
|
16
|
-
),
|
|
17
|
-
).toEqual(
|
|
18
|
-
'0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658',
|
|
19
|
-
)
|
|
20
|
-
})
|
|
21
|
-
it('throws error when label does not start with [', () => {
|
|
22
|
-
expect(() =>
|
|
23
|
-
decodeLabelhash(
|
|
24
|
-
'9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658]',
|
|
25
|
-
),
|
|
26
|
-
).toThrowErrorMatchingInlineSnapshot(`
|
|
27
|
-
"Invalid encoded label
|
|
28
|
-
|
|
29
|
-
- Supplied label: 9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658]
|
|
30
|
-
|
|
31
|
-
Details: Expected encoded labelhash to start and end with square brackets
|
|
32
|
-
|
|
33
|
-
Version: ${getVersion()}"
|
|
34
|
-
`)
|
|
35
|
-
})
|
|
36
|
-
it('throws error when label does not end with ]', () => {
|
|
37
|
-
expect(() =>
|
|
38
|
-
decodeLabelhash(
|
|
39
|
-
'[9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658',
|
|
40
|
-
),
|
|
41
|
-
).toThrowErrorMatchingInlineSnapshot(`
|
|
42
|
-
"Invalid encoded label
|
|
43
|
-
|
|
44
|
-
- Supplied label: [9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658
|
|
45
|
-
|
|
46
|
-
Details: Expected encoded labelhash to start and end with square brackets
|
|
47
|
-
|
|
48
|
-
Version: ${getVersion()}"
|
|
49
|
-
`)
|
|
50
|
-
})
|
|
51
|
-
it('throws error when label length is not 66', () => {
|
|
52
|
-
expect(() =>
|
|
53
|
-
decodeLabelhash(
|
|
54
|
-
'[9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb65]',
|
|
55
|
-
),
|
|
56
|
-
).toThrowErrorMatchingInlineSnapshot(`
|
|
57
|
-
"Invalid encoded label
|
|
58
|
-
|
|
59
|
-
- Supplied label: [9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb65]
|
|
60
|
-
|
|
61
|
-
Details: Expected encoded labelhash to have a length of 66
|
|
62
|
-
|
|
63
|
-
Version: ${getVersion()}"
|
|
64
|
-
`)
|
|
65
|
-
})
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
describe('encodeLabelhash()', () => {
|
|
69
|
-
it('encodes labelhash', () => {
|
|
70
|
-
expect(
|
|
71
|
-
encodeLabelhash(
|
|
72
|
-
'0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658',
|
|
73
|
-
),
|
|
74
|
-
).toEqual(
|
|
75
|
-
'[9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658]',
|
|
76
|
-
)
|
|
77
|
-
})
|
|
78
|
-
it('throws error when labelhash does not start with 0x', () => {
|
|
79
|
-
expect(() =>
|
|
80
|
-
encodeLabelhash(
|
|
81
|
-
'9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658',
|
|
82
|
-
),
|
|
83
|
-
).toThrowErrorMatchingInlineSnapshot(`
|
|
84
|
-
"Invalid labelhash
|
|
85
|
-
|
|
86
|
-
- Supplied labelhash: 9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658
|
|
87
|
-
|
|
88
|
-
Details: Expected labelhash to start with 0x
|
|
89
|
-
|
|
90
|
-
Version: ${getVersion()}"
|
|
91
|
-
`)
|
|
92
|
-
})
|
|
93
|
-
it('throws error when labelhash length is not 66', () => {
|
|
94
|
-
expect(() =>
|
|
95
|
-
encodeLabelhash(
|
|
96
|
-
'0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb65',
|
|
97
|
-
),
|
|
98
|
-
).toThrowErrorMatchingInlineSnapshot(`
|
|
99
|
-
"Invalid labelhash
|
|
100
|
-
|
|
101
|
-
- Supplied labelhash: 0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb65
|
|
102
|
-
|
|
103
|
-
Details: Expected labelhash to have a length of 66
|
|
104
|
-
|
|
105
|
-
Version: ${getVersion()}"
|
|
106
|
-
`)
|
|
107
|
-
})
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
describe('isEncodedLabelhash()', () => {
|
|
111
|
-
it('returns true when labelhash is encoded', () => {
|
|
112
|
-
expect(
|
|
113
|
-
isEncodedLabelhash(
|
|
114
|
-
'[9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658]',
|
|
115
|
-
),
|
|
116
|
-
).toBe(true)
|
|
117
|
-
})
|
|
118
|
-
it('returns false when labelhash is not encoded', () => {
|
|
119
|
-
expect(isEncodedLabelhash('sdfsdfsd')).toBe(false)
|
|
120
|
-
})
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
describe('saveLabel()', () => {
|
|
124
|
-
it('saves label to localStorage', () => {
|
|
125
|
-
jest.spyOn(global.localStorage, 'setItem')
|
|
126
|
-
saveLabel('test')
|
|
127
|
-
expect(global.localStorage.setItem).toHaveBeenCalledWith(
|
|
128
|
-
'ensjs:labels',
|
|
129
|
-
JSON.stringify({ [labelhash('test')]: 'test' }),
|
|
130
|
-
)
|
|
131
|
-
})
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
describe('saveName()', () => {
|
|
135
|
-
beforeEach(() => {
|
|
136
|
-
global.localStorage.clear()
|
|
137
|
-
})
|
|
138
|
-
it('saves each label from name to localStorage', () => {
|
|
139
|
-
jest.spyOn(global.localStorage, 'setItem')
|
|
140
|
-
saveName('test.eth')
|
|
141
|
-
expect(global.localStorage.setItem).toHaveBeenCalledWith(
|
|
142
|
-
'ensjs:labels',
|
|
143
|
-
JSON.stringify({ [labelhash('test')]: 'test' }),
|
|
144
|
-
)
|
|
145
|
-
expect(global.localStorage.setItem).toHaveBeenCalledWith(
|
|
146
|
-
'ensjs:labels',
|
|
147
|
-
JSON.stringify({
|
|
148
|
-
[labelhash('test')]: 'test',
|
|
149
|
-
[labelhash('eth')]: 'eth',
|
|
150
|
-
}),
|
|
151
|
-
)
|
|
152
|
-
})
|
|
153
|
-
it('does not save encoded label to localStorage', () => {
|
|
154
|
-
jest.spyOn(global.localStorage, 'setItem')
|
|
155
|
-
saveName(
|
|
156
|
-
'[9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658].eth',
|
|
157
|
-
)
|
|
158
|
-
expect(global.localStorage.setItem).toHaveBeenCalledWith(
|
|
159
|
-
'ensjs:labels',
|
|
160
|
-
JSON.stringify({ [labelhash('eth')]: 'eth' }),
|
|
161
|
-
)
|
|
162
|
-
})
|
|
163
|
-
})
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { makeLabelNodeAndParent } from './makeLabelNodeAndParent.js'
|
|
2
|
-
|
|
3
|
-
it('makes label node and parent', () => {
|
|
4
|
-
expect(makeLabelNodeAndParent('test.eth')).toMatchInlineSnapshot(`
|
|
5
|
-
{
|
|
6
|
-
"label": "test",
|
|
7
|
-
"labelhash": "0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658",
|
|
8
|
-
"parentNode": "0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae",
|
|
9
|
-
}
|
|
10
|
-
`)
|
|
11
|
-
})
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MAX_DATE_INT } from './consts.js'
|
|
2
|
-
import { makeSafeSecondsDate } from './makeSafeSecondsDate.js'
|
|
3
|
-
|
|
4
|
-
it('makes date from seconds', () => {
|
|
5
|
-
expect(makeSafeSecondsDate(21000)).toEqual(new Date(21000000))
|
|
6
|
-
})
|
|
7
|
-
it('makes date from seconds with big int', () => {
|
|
8
|
-
expect(makeSafeSecondsDate(21000n)).toEqual(new Date(21000000))
|
|
9
|
-
})
|
|
10
|
-
it('makes date from seconds with big int larger than max date int', () => {
|
|
11
|
-
expect(makeSafeSecondsDate(MAX_DATE_INT + 28930402)).toEqual(
|
|
12
|
-
new Date(MAX_DATE_INT),
|
|
13
|
-
)
|
|
14
|
-
})
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { namehash } from './normalise.js'
|
|
2
|
-
|
|
3
|
-
describe('namehash()', () => {
|
|
4
|
-
it('returns namehash for name', () => {
|
|
5
|
-
expect(namehash('test.eth')).toEqual(
|
|
6
|
-
'0xeb4f647bea6caa36333c816d7b46fdcb05f9466ecacc140ea8c66faf15b3d9f1',
|
|
7
|
-
)
|
|
8
|
-
})
|
|
9
|
-
it('returns namehash for name with encoded labelhash', () => {
|
|
10
|
-
expect(
|
|
11
|
-
namehash(
|
|
12
|
-
'[9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658].eth',
|
|
13
|
-
),
|
|
14
|
-
).toEqual(
|
|
15
|
-
'0xeb4f647bea6caa36333c816d7b46fdcb05f9466ecacc140ea8c66faf15b3d9f1',
|
|
16
|
-
)
|
|
17
|
-
})
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
it('exports functions from ens-normalize', async () => {
|
|
21
|
-
const modules = await import('./normalise.js')
|
|
22
|
-
expect(modules).toMatchInlineSnapshot(`
|
|
23
|
-
{
|
|
24
|
-
"beautify": [Function],
|
|
25
|
-
"emoji": [Function],
|
|
26
|
-
"isCombiningMark": [Function],
|
|
27
|
-
"namehash": [Function],
|
|
28
|
-
"normalise": [Function],
|
|
29
|
-
"normaliseFragment": [Function],
|
|
30
|
-
"shouldEscape": [Function],
|
|
31
|
-
"split": [Function],
|
|
32
|
-
"tokenise": [Function],
|
|
33
|
-
}
|
|
34
|
-
`)
|
|
35
|
-
})
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { getVersion } from '../errors/error-utils.js'
|
|
2
|
-
import { deploymentAddresses, publicClient } from '../tests/addTestContracts.js'
|
|
3
|
-
import { namehash } from './normalise.js'
|
|
4
|
-
import { ownerFromContract } from './ownerFromContract.js'
|
|
5
|
-
|
|
6
|
-
const baseParams = {
|
|
7
|
-
client: publicClient,
|
|
8
|
-
namehash: namehash('test.eth'),
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
it('uses nameWrapper contract when contract is nameWrapper', () => {
|
|
12
|
-
expect(ownerFromContract({ ...baseParams, contract: 'nameWrapper' }))
|
|
13
|
-
.toMatchInlineSnapshot(`
|
|
14
|
-
{
|
|
15
|
-
"data": "0x6352211eeb4f647bea6caa36333c816d7b46fdcb05f9466ecacc140ea8c66faf15b3d9f1",
|
|
16
|
-
"to": "${deploymentAddresses.NameWrapper}",
|
|
17
|
-
}
|
|
18
|
-
`)
|
|
19
|
-
})
|
|
20
|
-
it('uses registry contract when contract is registry', () => {
|
|
21
|
-
expect(ownerFromContract({ ...baseParams, contract: 'registry' }))
|
|
22
|
-
.toMatchInlineSnapshot(`
|
|
23
|
-
{
|
|
24
|
-
"data": "0x02571be3eb4f647bea6caa36333c816d7b46fdcb05f9466ecacc140ea8c66faf15b3d9f1",
|
|
25
|
-
"to": "${deploymentAddresses.ENSRegistry}",
|
|
26
|
-
}
|
|
27
|
-
`)
|
|
28
|
-
})
|
|
29
|
-
it('uses registrar contract when contract is registrar', () => {
|
|
30
|
-
expect(
|
|
31
|
-
ownerFromContract({
|
|
32
|
-
...baseParams,
|
|
33
|
-
contract: 'registrar',
|
|
34
|
-
labels: ['test'],
|
|
35
|
-
}),
|
|
36
|
-
).toMatchInlineSnapshot(`
|
|
37
|
-
{
|
|
38
|
-
"data": "0x6352211e9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658",
|
|
39
|
-
"to": "${deploymentAddresses.BaseRegistrarImplementation}",
|
|
40
|
-
}
|
|
41
|
-
`)
|
|
42
|
-
})
|
|
43
|
-
it('throws when contract is not nameWrapper, registry, or registrar', () => {
|
|
44
|
-
expect(() => ownerFromContract({ ...baseParams, contract: 'invalid' as any }))
|
|
45
|
-
.toThrowErrorMatchingInlineSnapshot(`
|
|
46
|
-
"Invalid contract type: invalid
|
|
47
|
-
|
|
48
|
-
- Supported contract types: nameWrapper, registry, registrar
|
|
49
|
-
|
|
50
|
-
Version: ${getVersion()}"
|
|
51
|
-
`)
|
|
52
|
-
})
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { labelhash } from 'viem'
|
|
2
|
-
import { getVersion } from '../errors/error-utils.js'
|
|
3
|
-
import { namehash } from './normalise.js'
|
|
4
|
-
import {
|
|
5
|
-
makeCommitment,
|
|
6
|
-
makeCommitmentFromTuple,
|
|
7
|
-
makeCommitmentTuple,
|
|
8
|
-
makeRegistrationTuple,
|
|
9
|
-
randomSecret,
|
|
10
|
-
type RegistrationParameters,
|
|
11
|
-
} from './registerHelpers.js'
|
|
12
|
-
|
|
13
|
-
describe('randomSecret()', () => {
|
|
14
|
-
it('generates a random secret with no args', () => {
|
|
15
|
-
const secret = randomSecret()
|
|
16
|
-
expect(secret).toHaveLength(66)
|
|
17
|
-
})
|
|
18
|
-
it('generates a random secret with a platform domain', () => {
|
|
19
|
-
const hash = namehash('test.eth')
|
|
20
|
-
const secret = randomSecret({ platformDomain: 'test.eth' })
|
|
21
|
-
expect(secret).toHaveLength(66)
|
|
22
|
-
expect(secret.slice(2, 10)).toEqual(hash.slice(2, 10))
|
|
23
|
-
})
|
|
24
|
-
it('generates a random secret with a campaign', () => {
|
|
25
|
-
const secret = randomSecret({ campaign: 1 })
|
|
26
|
-
expect(secret).toHaveLength(66)
|
|
27
|
-
expect(secret.slice(10, 18)).toEqual('00000001')
|
|
28
|
-
})
|
|
29
|
-
it('throws when campaign is too large', () => {
|
|
30
|
-
expect(() => randomSecret({ campaign: 0xffffffff + 1 }))
|
|
31
|
-
.toThrowErrorMatchingInlineSnapshot(`
|
|
32
|
-
"Campaign reference 4294967296 is too large
|
|
33
|
-
|
|
34
|
-
- Max campaign reference: 4294967295
|
|
35
|
-
|
|
36
|
-
Version: ${getVersion()}"
|
|
37
|
-
`)
|
|
38
|
-
})
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
describe('makeCommitmentTuple()', () => {
|
|
42
|
-
it('generates a commitment tuple', () => {
|
|
43
|
-
const tuple = makeCommitmentTuple({
|
|
44
|
-
name: 'test.eth',
|
|
45
|
-
owner: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
46
|
-
duration: 31536000,
|
|
47
|
-
secret: '0xsecret',
|
|
48
|
-
})
|
|
49
|
-
// labelhash
|
|
50
|
-
expect(tuple[0]).toBe(labelhash('test'))
|
|
51
|
-
// owner
|
|
52
|
-
expect(tuple[1]).toBe('0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266')
|
|
53
|
-
// duration
|
|
54
|
-
expect(tuple[2]).toBe(31536000n)
|
|
55
|
-
// secret
|
|
56
|
-
expect(tuple[3]).toBe('0xsecret')
|
|
57
|
-
// resolver address
|
|
58
|
-
expect(tuple[4]).toBe('0x0000000000000000000000000000000000000000')
|
|
59
|
-
// records
|
|
60
|
-
expect(tuple[5]).toStrictEqual([])
|
|
61
|
-
// reverse record
|
|
62
|
-
expect(tuple[6]).toBe(false)
|
|
63
|
-
// owner controlled fuses
|
|
64
|
-
expect(tuple[7]).toBe(0)
|
|
65
|
-
})
|
|
66
|
-
it('encodes fuses when supplied', () => {
|
|
67
|
-
const tuple = makeCommitmentTuple({
|
|
68
|
-
name: 'test.eth',
|
|
69
|
-
owner: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
70
|
-
duration: 31536000,
|
|
71
|
-
secret: '0xsecret',
|
|
72
|
-
fuses: {
|
|
73
|
-
named: ['CANNOT_UNWRAP', 'CANNOT_BURN_FUSES'],
|
|
74
|
-
},
|
|
75
|
-
})
|
|
76
|
-
expect(tuple[7]).toBe(3)
|
|
77
|
-
})
|
|
78
|
-
it('adds ETH coin when reverse record is supplied and no ETH coin is supplied', () => {
|
|
79
|
-
const tuple = makeCommitmentTuple({
|
|
80
|
-
name: 'test.eth',
|
|
81
|
-
owner: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
82
|
-
duration: 31536000,
|
|
83
|
-
secret: '0xsecret',
|
|
84
|
-
reverseRecord: true,
|
|
85
|
-
})
|
|
86
|
-
expect(tuple[5]).toMatchInlineSnapshot(`
|
|
87
|
-
[
|
|
88
|
-
"0x8b95dd71eb4f647bea6caa36333c816d7b46fdcb05f9466ecacc140ea8c66faf15b3d9f1000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000014f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000",
|
|
89
|
-
]
|
|
90
|
-
`)
|
|
91
|
-
expect(tuple[6]).toBe(true)
|
|
92
|
-
})
|
|
93
|
-
it('does not add ETH coin when reverse record is supplied and ETH coin is supplied', () => {
|
|
94
|
-
const tuple = makeCommitmentTuple({
|
|
95
|
-
name: 'test.eth',
|
|
96
|
-
owner: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
97
|
-
duration: 31536000,
|
|
98
|
-
records: {
|
|
99
|
-
coins: [
|
|
100
|
-
{ coin: 'ETH', value: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266' },
|
|
101
|
-
],
|
|
102
|
-
},
|
|
103
|
-
secret: '0xsecret',
|
|
104
|
-
reverseRecord: true,
|
|
105
|
-
})
|
|
106
|
-
expect(tuple[5]).toMatchInlineSnapshot(`
|
|
107
|
-
[
|
|
108
|
-
"0x8b95dd71eb4f647bea6caa36333c816d7b46fdcb05f9466ecacc140ea8c66faf15b3d9f1000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000014f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000",
|
|
109
|
-
]
|
|
110
|
-
`)
|
|
111
|
-
expect(tuple[6]).toBe(true)
|
|
112
|
-
})
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
describe('makeRegistrationTuple()', () => {
|
|
116
|
-
it('replaces labelhash from commitment tuple with label', () => {
|
|
117
|
-
const data: RegistrationParameters = {
|
|
118
|
-
name: 'test.eth',
|
|
119
|
-
owner: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
120
|
-
duration: 31536000,
|
|
121
|
-
secret: '0xsecret',
|
|
122
|
-
}
|
|
123
|
-
const commitmentTuple = makeCommitmentTuple(data)
|
|
124
|
-
const registrationTuple = makeRegistrationTuple(data)
|
|
125
|
-
expect(registrationTuple[0]).toBe('test')
|
|
126
|
-
expect(registrationTuple.slice(1)).toEqual(commitmentTuple.slice(1))
|
|
127
|
-
})
|
|
128
|
-
})
|
|
129
|
-
|
|
130
|
-
describe('makeCommitmentFromTuple()', () => {
|
|
131
|
-
it('generates a commitment from a tuple', () => {
|
|
132
|
-
const tuple = makeCommitmentTuple({
|
|
133
|
-
name: 'test.eth',
|
|
134
|
-
owner: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
135
|
-
duration: 31536000,
|
|
136
|
-
secret:
|
|
137
|
-
'0xde99acb8241826c5b3012b2c7a05dc28043428744a9c39445b4707c92b3fc054',
|
|
138
|
-
})
|
|
139
|
-
const commitment = makeCommitmentFromTuple(tuple)
|
|
140
|
-
expect(commitment).toMatchInlineSnapshot(
|
|
141
|
-
`"0x0d7fe28313600187945700f6c6374cc0ba4a360df039b3e62d435506e69dbe63"`,
|
|
142
|
-
)
|
|
143
|
-
})
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
describe('makeCommitment()', () => {
|
|
147
|
-
it('generates a commitment from a RegistrationParameters', () => {
|
|
148
|
-
const commitment = makeCommitment({
|
|
149
|
-
name: 'test.eth',
|
|
150
|
-
owner: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
151
|
-
duration: 31536000,
|
|
152
|
-
secret:
|
|
153
|
-
'0xde99acb8241826c5b3012b2c7a05dc28043428744a9c39445b4707c92b3fc054',
|
|
154
|
-
})
|
|
155
|
-
expect(commitment).toMatchInlineSnapshot(
|
|
156
|
-
`"0x0d7fe28313600187945700f6c6374cc0ba4a360df039b3e62d435506e69dbe63"`,
|
|
157
|
-
)
|
|
158
|
-
})
|
|
159
|
-
})
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
-
import { getVersion } from '../errors/error-utils.js'
|
|
3
|
-
import { parseInput, validateName } from './validation.js'
|
|
4
|
-
|
|
5
|
-
declare namespace localStorage {
|
|
6
|
-
const getItem: jest.MockedFn<Storage['getItem']>
|
|
7
|
-
const setItem: jest.MockedFn<Storage['setItem']>
|
|
8
|
-
const removeItem: jest.MockedFn<Storage['removeItem']>
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const labelsMock = {
|
|
12
|
-
'0x68371d7e884c168ae2022c82bd837d51837718a7f7dfb7aa3f753074a35e1d87':
|
|
13
|
-
'something',
|
|
14
|
-
'0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0': 'eth',
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const labelsMockJSON = JSON.stringify(labelsMock)
|
|
18
|
-
|
|
19
|
-
describe('validateName()', () => {
|
|
20
|
-
beforeEach(() => {
|
|
21
|
-
localStorage.getItem.mockClear()
|
|
22
|
-
localStorage.setItem.mockClear()
|
|
23
|
-
localStorage.getItem.mockImplementation(() => labelsMockJSON)
|
|
24
|
-
})
|
|
25
|
-
it('should throw if the name has an empty label', () => {
|
|
26
|
-
expect(() => validateName('foo..bar')).toThrowError(
|
|
27
|
-
'Name cannot have empty labels',
|
|
28
|
-
)
|
|
29
|
-
expect(() => validateName('.foo.bar')).toThrowError(
|
|
30
|
-
'Name cannot have empty labels',
|
|
31
|
-
)
|
|
32
|
-
expect(() => validateName('foo.bar.')).toThrowError(
|
|
33
|
-
'Name cannot have empty labels',
|
|
34
|
-
)
|
|
35
|
-
})
|
|
36
|
-
it('should allow names with [root] as a label', () => {
|
|
37
|
-
expect(validateName('[root]')).toEqual('[root]')
|
|
38
|
-
})
|
|
39
|
-
it('should throw if the name has [root] as a label and is not the only label', () => {
|
|
40
|
-
expect(() => validateName('foo.[root].bar'))
|
|
41
|
-
.toThrowErrorMatchingInlineSnapshot(`
|
|
42
|
-
"Root name cannot have other labels
|
|
43
|
-
|
|
44
|
-
- Supplied name: foo.[root].bar
|
|
45
|
-
|
|
46
|
-
Version: ${getVersion()}"
|
|
47
|
-
`)
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
it('should get the decoded label hash from local storage', () => {
|
|
51
|
-
expect(
|
|
52
|
-
validateName(
|
|
53
|
-
'thing.[68371d7e884c168ae2022c82bd837d51837718a7f7dfb7aa3f753074a35e1d87].eth',
|
|
54
|
-
),
|
|
55
|
-
).toEqual('thing.something.eth')
|
|
56
|
-
expect(localStorage.getItem).toHaveBeenCalled()
|
|
57
|
-
})
|
|
58
|
-
it('should fallback to encoded label hash if the decoded label hash is not in local storage', () => {
|
|
59
|
-
expect(
|
|
60
|
-
validateName(
|
|
61
|
-
'something.[8c6c947d200f53fa1127b152f95b118f9e1d0eeb06fc678b6fc8a6d5c6fc5e17].eth',
|
|
62
|
-
),
|
|
63
|
-
).toEqual(
|
|
64
|
-
'something.[8c6c947d200f53fa1127b152f95b118f9e1d0eeb06fc678b6fc8a6d5c6fc5e17].eth',
|
|
65
|
-
)
|
|
66
|
-
expect(localStorage.getItem).toHaveBeenCalled()
|
|
67
|
-
expect(
|
|
68
|
-
validateName(
|
|
69
|
-
'[8c6c947d200f53fa1127b152f95b118f9e1d0eeb06fc678b6fc8a6d5c6fc5e17]',
|
|
70
|
-
),
|
|
71
|
-
).toEqual(
|
|
72
|
-
'[8c6c947d200f53fa1127b152f95b118f9e1d0eeb06fc678b6fc8a6d5c6fc5e17]',
|
|
73
|
-
)
|
|
74
|
-
})
|
|
75
|
-
it('should normalise the name', () => {
|
|
76
|
-
expect(validateName('aAaaA.eth')).toEqual('aaaaa.eth')
|
|
77
|
-
})
|
|
78
|
-
it('should save the normalised name to local storage', () => {
|
|
79
|
-
validateName('swAgCity.eth')
|
|
80
|
-
expect(localStorage.setItem).toHaveBeenCalledWith(
|
|
81
|
-
'ensjs:labels',
|
|
82
|
-
JSON.stringify({
|
|
83
|
-
...labelsMock,
|
|
84
|
-
'0xee3bbc5c1db3f1dbd5ec4cdfd627fb76aba6215d814354b6c0f8d74253adf1a8':
|
|
85
|
-
'swagcity',
|
|
86
|
-
}),
|
|
87
|
-
)
|
|
88
|
-
})
|
|
89
|
-
it('should return the normalised name', () => {
|
|
90
|
-
expect(validateName('swAgCity.eth')).toEqual('swagcity.eth')
|
|
91
|
-
})
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
describe('parseInput()', () => {
|
|
95
|
-
it('should parse the input', () => {
|
|
96
|
-
expect(parseInput('bar.eth')).toEqual({
|
|
97
|
-
type: 'name',
|
|
98
|
-
normalised: 'bar.eth',
|
|
99
|
-
isShort: false,
|
|
100
|
-
isValid: true,
|
|
101
|
-
is2LD: true,
|
|
102
|
-
isETH: true,
|
|
103
|
-
labelDataArray: expect.any(Array),
|
|
104
|
-
})
|
|
105
|
-
})
|
|
106
|
-
it('should return a normalised name', () => {
|
|
107
|
-
expect(parseInput('bAr.etH').normalised).toEqual('bar.eth')
|
|
108
|
-
})
|
|
109
|
-
it('should parse the input if it is invalid', () => {
|
|
110
|
-
expect(parseInput('bar..eth')).toEqual({
|
|
111
|
-
type: 'name',
|
|
112
|
-
normalised: undefined,
|
|
113
|
-
isShort: false,
|
|
114
|
-
isValid: false,
|
|
115
|
-
is2LD: false,
|
|
116
|
-
isETH: true,
|
|
117
|
-
labelDataArray: expect.any(Array),
|
|
118
|
-
})
|
|
119
|
-
})
|
|
120
|
-
it('should return type as label if input is a label', () => {
|
|
121
|
-
expect(parseInput('bar').type).toEqual('label')
|
|
122
|
-
})
|
|
123
|
-
describe('should return correct value', () => {
|
|
124
|
-
describe('isShort', () => {
|
|
125
|
-
it('should return true if input is label and less than 3 characters', () => {
|
|
126
|
-
expect(parseInput('ba').isShort).toEqual(true)
|
|
127
|
-
})
|
|
128
|
-
it('should return true if input is less than 3 char emoji', () => {
|
|
129
|
-
expect(parseInput('🇺🇸').isShort).toEqual(true)
|
|
130
|
-
})
|
|
131
|
-
it('should return false if input is 3 char emoji', () => {
|
|
132
|
-
expect(parseInput('🏳️🌈').isShort).toEqual(false)
|
|
133
|
-
})
|
|
134
|
-
it('should return false if input is label and 3 characters', () => {
|
|
135
|
-
expect(parseInput('bar').isShort).toEqual(false)
|
|
136
|
-
})
|
|
137
|
-
it('should return true if input is 2LD .eth name and label is less than 3 characters', () => {
|
|
138
|
-
expect(parseInput('ba.eth').isShort).toEqual(true)
|
|
139
|
-
})
|
|
140
|
-
it('should return false if input is 2LD .eth name and label is 3 characters', () => {
|
|
141
|
-
expect(parseInput('bar.eth').isShort).toEqual(false)
|
|
142
|
-
})
|
|
143
|
-
it('should return false if input is 2LD other name and label is less than 3 characters', () => {
|
|
144
|
-
expect(parseInput('ba.com').isShort).toEqual(false)
|
|
145
|
-
})
|
|
146
|
-
it('should return false if input is 3LD .eth name and label is less than 3 characters', () => {
|
|
147
|
-
expect(parseInput('ba.bar.eth').isShort).toEqual(false)
|
|
148
|
-
})
|
|
149
|
-
})
|
|
150
|
-
describe('is2LD', () => {
|
|
151
|
-
it('should return true if input is 2LD name', () => {
|
|
152
|
-
expect(parseInput('bar.eth').is2LD).toEqual(true)
|
|
153
|
-
})
|
|
154
|
-
it('should return false if input is 3LD name', () => {
|
|
155
|
-
expect(parseInput('bar.foo.eth').is2LD).toEqual(false)
|
|
156
|
-
})
|
|
157
|
-
it('should return false if input is label', () => {
|
|
158
|
-
expect(parseInput('bar').is2LD).toEqual(false)
|
|
159
|
-
})
|
|
160
|
-
})
|
|
161
|
-
describe('isETH', () => {
|
|
162
|
-
it('should return true if input is .eth name', () => {
|
|
163
|
-
expect(parseInput('bar.eth').isETH).toEqual(true)
|
|
164
|
-
})
|
|
165
|
-
it('should return false if input is other name', () => {
|
|
166
|
-
expect(parseInput('bar.com').isETH).toEqual(false)
|
|
167
|
-
})
|
|
168
|
-
})
|
|
169
|
-
})
|
|
170
|
-
})
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { getVersion } from '../errors/error-utils.js'
|
|
2
|
-
import { expiryToBigInt, wrappedLabelLengthCheck } from './wrapper.js'
|
|
3
|
-
|
|
4
|
-
describe('expiryToBigInt', () => {
|
|
5
|
-
it('returns default value when expiry is undefined', () => {
|
|
6
|
-
expect(expiryToBigInt(undefined)).toEqual(0n)
|
|
7
|
-
})
|
|
8
|
-
it('allows custom default value', () => {
|
|
9
|
-
expect(expiryToBigInt(undefined, 123n)).toEqual(123n)
|
|
10
|
-
})
|
|
11
|
-
it('returns bigint expiry when expiry is bigint', () => {
|
|
12
|
-
expect(expiryToBigInt(123n)).toEqual(123n)
|
|
13
|
-
})
|
|
14
|
-
it('returns bigint expiry when expiry is string', () => {
|
|
15
|
-
expect(expiryToBigInt('123')).toEqual(123n)
|
|
16
|
-
})
|
|
17
|
-
it('returns bigint expiry when expiry is number', () => {
|
|
18
|
-
expect(expiryToBigInt(123)).toEqual(123n)
|
|
19
|
-
})
|
|
20
|
-
it('returns bigint expiry when expiry is Date', () => {
|
|
21
|
-
expect(expiryToBigInt(new Date(123000))).toEqual(123n)
|
|
22
|
-
})
|
|
23
|
-
it('throws when expiry is not bigint, string, number or Date', () => {
|
|
24
|
-
expect(() => expiryToBigInt({} as any)).toThrowErrorMatchingInlineSnapshot(
|
|
25
|
-
`"Expiry must be a bigint, string, number or Date"`,
|
|
26
|
-
)
|
|
27
|
-
})
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
describe('wrappedLabelLengthCheck', () => {
|
|
31
|
-
it('returns undefined when label is less than 255 bytes', () => {
|
|
32
|
-
expect(wrappedLabelLengthCheck('a'.repeat(255))).toBeUndefined()
|
|
33
|
-
})
|
|
34
|
-
it('throws when label is more than 255 bytes', () => {
|
|
35
|
-
expect(() => wrappedLabelLengthCheck('a'.repeat(256)))
|
|
36
|
-
.toThrowErrorMatchingInlineSnapshot(`
|
|
37
|
-
"Supplied label was too long
|
|
38
|
-
|
|
39
|
-
- Supplied label: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
|
40
|
-
- Max byte length: 255
|
|
41
|
-
- Actual byte length: 256
|
|
42
|
-
|
|
43
|
-
Version: ${getVersion()}"
|
|
44
|
-
`)
|
|
45
|
-
})
|
|
46
|
-
})
|