All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Add Solana CAIP namespace (#219)
- BREAKING: Drop support for Node.js versions 16, 21 (#212)
- Improve JSON validation performance (#218)
- Fix wrong types for CAIP-2 and CAIP-10 structs (#210)
- Add
Wallet
member toKnownCaipNamespace
enum (#207)
- Add
PublicInterface
type (#197)
- BREAKING: The return types of functions
getChecksumAddress
,numberToHex
,bigIntToHex
are narrowed fromstring
toHex
(#193)
- Bump
@metamask/superstruct
from^3.0.0
to^3.1.0
(#194)- If
@metamask/utils
<=8.5.0
is used with@metamask/superstruct
>=3.1.0
the following error may be encountered:
This can be resolved by updatingerror TS2742: The inferred type of 'ExampleType' cannot be named without a reference to '@metamask/utils/node_modules/@metamask/superstruct'. This is likely not portable. A type annotation is necessary.
@metamask/utils
to>=9.0.0
. - If
- Bump dependency
semver
from^5.7.1
to^7.6.0
(#181).
- Replace dependency
superstruct
^1.0.3
with ESM-compatible@metamask/superstruct
^3.0.0
(#185).- This fixes the issue of this package being unusable by any TypeScript project that uses
Node16
orNodeNext
as itsmoduleResolution
option.
- This fixes the issue of this package being unusable by any TypeScript project that uses
- Produce and export ESM-compatible TypeScript type declaration files in addition to CommonJS-compatible declaration files (#182)
- Previously, this package shipped with only one variant of type declaration files, and these files were only CommonJS-compatible, and the
exports
field inpackage.json
linked to these files. This is an anti-pattern and was rightfully flagged by the "Are the Types Wrong?" tool as "masquerading as CJS". All of the ATTW checks now pass.
- Previously, this package shipped with only one variant of type declaration files, and these files were only CommonJS-compatible, and the
- Remove chunk files (#182).
- Previously, the build tool we used to generate JavaScript files extracted common code to "chunk" files. While this was intended to make this package more tree-shakeable, it also made debugging more difficult for our development teams. These chunk files are no longer present.
- Update docs for
createDeferredPromise
to caution against usingsuppressUnhandledRejection
(#174)
- Fix
createSandbox
to assign a unique name to the sandbox directory, so that it can be used in multiple concurrently running Jest tests (#171)
- Add
createDeferredPromise
(#164)
- Fix issue with source maps where line numbers were incorrect for src/error.ts (#156)
- Add struct utils for validating JSON objects with optional values (#136)
- Add filesystem utils (#148)
- Add error utils (#146, #151)
- Add base64 encoding and decoding functions (#145)
- Use
tsup
for bundling (#144)- This makes the package fully compliant with ES modules.
- Bump
@ethereumjs/tx
from4.1.2
to4.2.0
(#133)
- Make types for JSON-RPC-related structs more accurate (#134)
- Aligning
JsonRpcParams
to be optional, yet notundefined
. - Updated types:
InferWithParams
JsonRpcNotificationStruct
JsonRpcParamsStruct
JsonRpcRequestStruct
- Aligning
- BREAKING:
JsonRpcParams
type no longer acceptsundefined
as value, asundefined
is not a valid JSON type (#130)
- Add CAIP-2 and CAIP-10 types (#116)
- Add
getKnownPropertyNames
function (#111)
- BREAKING: Build the package as both CJS and ESM (#115, #124)
- It's no longer possible to import from the
dist
folder. Everything must be imported from@metamask/utils
.
- It's no longer possible to import from the
- Bump
semver
to^7.5.4
(#123)
- Add address related utils (#112)
isValidHexAddress
has been added to check the validity of an hex addressgetChecksumAddress
has been added to calculate the ERC-55 mixed-case checksum of an hex addressisValidChecksumAddress
has been added to check the validity of an ERC-55 mixed-case checksum address
- Add optional
destroy
method toKeyring
type (#108)
- Strip
__proto__
andconstructor
JSON properties ingetSafeJson
(#105)
- Fix JSON validation security issue (#103)
- This adds a new function
getSafeJson
which validates and returns sanitized JSON.
- This adds a new function
- The
Keyring
exposes a new optional methodinit
(#99)
- Bump
@ethereumjs/tx
to4.1.2
to address runtime compatibility issues (#100)
- Keep original type when using
hasProperty
if defined (#94)
- BREAKING: Update
Keyring
type (#89)- The
Keyring
class now uses the data typesTypedTransaction
andTxData
from@ethereumjs/tx
(v4.1.1
). - The
Keyring
now exposes a new optional method calledgenerateRandomMnemonic
.
- The
- Export new modules (
keyring
,transaction-types
, andencryption-types
) (#86) - BREAKING: Improve JSON validation (#85)
- Fixes edge cases in our JSON validation logic.
- The previous function used for JSON validation (
validateJsonAndGetSize
) was removed.- The
isValidJson
function now uses the new JSON validation logic. - To get the size of a JSON value, you can use the
getJsonSize
function.
- The
- Add
Keyring
types (#74)- New data types added. These are
Keyring
,Transaction
(LegacyTransaction
,EIP2930Transaction
,EIP1559Transaction
),SignedTransaction
,Signature
, andEip1024EncryptedData
.
- New data types added. These are
- Improve the
hasProperty
function (#79, #80)- This function now acts as a type guard, informing TypeScript that the property exists.
- The function is now compatible with more types of objects, such as Errors and class instances.
- Bump
superstruct
to^1.0.3
(#71)
- JSON-RPC types now have a default generic
Params
value (#54)
- JSON-RPC parameters are now properly cast to Json upon validation (#51)
- Add more assertion utils (#49)
- Add JSON-RPC error validation functions (#46)
- Add convenience function for creating a
DataView
(#45)
- Update JSON validation logic (#47)
- Validation would previously allow for
undefined
values, which is not a standard JSON type
- Validation would previously allow for
- Add
PendingJsonRpcResponse
type (#43) - Add utils for converting between numbers and hex (#41)
- Add coercion utils (#38)
- Make JSON-RPC error
data
property optional (#31) - Don't include test files in dist folder (#35)
- Fix typo in README (#28)
- Allow omitting JSON-RPC params when params can be undefined (#29)
- Bump
superstruct
to ^0.16.5 (#26)superstruct
s 0.16.1 through 0.16.4 were not compatible with Node 14; this restores that compatibility.
- Promote
@types/debug
from development dependencies to production dependencies (#23)
- BREAKING: Improve types and type validation (#19)
- Various type changes have been made that might be breaking:
- The
JsonRpcRequest
andJsonRpcNotification
types now include a generic constraint requiring that theParams
type extends theJsonRpcParams
type. - The
JsonRpcSuccess
andJsonRpcResponse
types now include a generic contraint for theResult
type, requiring that it extends theJson
type. - Various validation functions now accept
unknown
parameters rather than specific types. This should not be breaking except that it may affect type inference for the parameters passed in.
- The
- New JSON-related functions have been added:
assertIsJsonRpcResponse
isJsonRpcResponse
InferWithParams
JsonRpcParams
- New JSON Struct types have been added:
JsonRpcErrorStruct
JsonRpcFailureStruct
JsonRpcIdStruct
JsonRpcParamsStruct
JsonRpcRequestStruct
JsonRpcResponseStruct
JsonRpcSuccessStruct
JsonRpcVersionStruct
JsonStruct
- Various type changes have been made that might be breaking:
- Add JSON storage validation and limit utilities (#14)
- Adds a new function
validateJsonAndGetSize
.
- Adds a new function
- Add more JSON utils (#8)
- BREAKING: Refactor and expand time utils (#9)
- Adds a new function,
inMilliseconds
, and moves the time constants into a TypeScriptenum
.
- Adds a new function,
- Initial release