Repository navigation
Releases
ox@1.9.3
Patch Changes
- #749
734fbefThanks @tcoratger! - FixedTxEnvelopeEip4844.deserializeandTxEnvelopeEip7702.deserializeto throwTransactionEnvelope.MissingToErrorwhentois empty, since blob and set-code transactions cannot create a contract.
ox@1.9.2
Patch Changes
-
#737
92004e3Thanks @jxom! - FixedAbiParameters.decoderejecting its own encoding of zero-width array elements or tuple components (such asuint256[0][]or(string[0], uint256[0])) that end at the end of the data. -
#742
0910d5dThanks @jxom! - Added auserVerificationoption toAuthentication.verify(default'required').metadata.userVerificationRequiredno longer decides whether the UV flag is checked.Authentication.verify({ challenge, metadata, publicKey, signature, + userVerification: 'preferred', // to accept assertions without user verification }) -
#743
323933bThanks @jxom! - FixedExecute.decodeDataandExecute.decodeBatchOfBatchesDatato readopDataonly when the first head word is at least0x40, asERC7821.soldoes. -
#737
92004e3Thanks @jxom! - FixedSignatureErc8010.unwrapthrowing a nativeSyntaxErrorinstead ofSignatureErc8010.InvalidWrappedSignatureErrorfor a wrapped signature shorter than its length word and magic bytes. -
#737
92004e3Thanks @jxom! -RpcTransport.fromHttprejected a JSON-RPC response whoseiddid not match the requestid(exceptid: nullon an error response) withRpcTransport.ResponseIdMismatchError, instead of resolving with another request's result. -
#737
92004e3Thanks @jxom! -TxEnvelope*.deserializerejected integer fields with a leading zero byte,uint256fields longer than 32 bytes (uint64for the EIP-7702 and authorizationnonce), integer fields given as RLP lists, and access-list entries that are not[address, storageKeys]pairs, as the execution specs do, instead of decoding them to a transaction whose serialization and hash differ from the input. -
#741
a7cf2abThanks @jxom! - FixedWebCryptoP256.verifyto left-padrandsshorter than 32 bytes, asP256.verifydoes.
ox@0.16.0
Minor Changes
-
#750
e862358Thanks @jxom! - Breaking: Updated EIP-8141 frame transactions and EIP-8250 keyed nonces to the current specifications:TxEnvelopeEip8141replacesmaxFeePerGasandmaxFeePerBlobGaswith a totalmaxFeebudget (encoded asfees = [maxFee, maxPriorityFeePerGas], and asmaxFeein RPC,TransactionRequest, andTransaction),getSignPayloadcommits to the byte length of canonical-payload signatures instead of eliding them, the expiry verifier moved to0x81413f0cF12e9b6a49B1D0439E081c577D57FfFf,nonceKeys: []selects the legacy nonce (zero is an ordinary key), non-empty keys accept a single-use sequence of2^64 - 1, and intrinsic gas prices keyed nonce access and canonical-payload signature bytes as the specifications do.TxEnvelopeEip8141.from({ chainId, frames, - maxFeePerGas: Value.fromGwei('10'), + maxFee: Value.fromEther('0.01'), maxPriorityFeePerGas: Value.fromGwei('1'), - nonceKeys: [0n], + nonceKeys: [], sender, })
ox@0.15.3
ox@0.15.2
Patch Changes
-
#744
56b2ccfThanks @jxom! - Added auserVerificationoption toAuthentication.verify(default'required').metadata.userVerificationRequiredno longer decides whether the UV flag is checked.Authentication.verify({ challenge, metadata, publicKey, signature, + userVerification: 'preferred', // to accept assertions without user verification }) -
#745
eaca8a7Thanks @jxom! - 8000 FixedExecute.decodeDatato readopDataonly when the first head word is at least0x40, asERC7821.soldoes.
ox@1.9.1
Patch Changes
-
#729
97fa384Thanks @jxom! - FixedAbiParameters.decodeto throwAbiParameters.DataSizeTooSmallErrorwhen a static parameter head after a dynamic parameter is missing, instead of reading an earlier word as its value. -
#729
97fa384Thanks @jxom! - AddedblockAccessListHash(EIP-7928) andslotNumber(EIP-7843) toBlock.Block,Block.fromRpc,Block.toRpc, and the zodBlockschemas. -
#729
97fa384Thanks @jxom! - AddedbaseFeePerBlobGasandblobGasUsedRatiotoFee.FeeHistory,Fee.fromHistoryRpc,Fee.toHistoryRpc, and the zodFeeHistoryschema. -
#729
97fa384Thanks @jxom! - FixedPersonalMessage.encodeto throwHex.InvalidLengthErrorfor odd-length hex instead of returning a misaligned message. -
#729
97fa384Thanks @jxom! - FixedHex.toString,Bytes.toString, andAbiParameters.decodeto keep a leading U+FEFF in decoded strings instead of dropping it as a byte order mark.
ox@0.15.1
Patch Changes
-
#730
d542947Thanks @jxom! - FixedAbiParameters.decodeto throw when a static parameter head after a dynamic parameter is missing, instead of reading an earlier word as its value. -
#730
d542947Thanks @jxom! - AddedblockAccessListHash(EIP-7928) andslotNumber(EIP-7843) toBlock.Block,Block.fromRpc, andBlock.toRpc. -
#730
d542947Thanks @jxom! - AddedbaseFeePerBlobGasandblobGasUsedRatiotoFee.FeeHistory. -
#730
d542947Thanks @jxom! - FixedPersonalMessage.encodeto throwHex.InvalidLengthErrorfor odd-length hex instead of returning a misaligned message. -
#730
d542947Thanks @jxom! - FixedHex.toString,Bytes.toString, andAbiParameters.decodeto keep a leading U+FEFF in decoded strings instead of dropping it as a byte order mark.
ox@1.9.0
Minor Changes
-
#727
13ae075Thanks @jxom! - ImprovedAbiEvent.extractLogstype-checking performance: with several event names the event type is selected by name without computing the overload arguments of every event, and without an event name it is the ABI's events, which also types an overloaded event's arguments as the union of its overloads instead ofunknown(5 to 10× fewer instantiations per call). -
#727
13ae075Thanks @jxom! - FixedRlp.from,Rlp.fromHexandRlp.fromBytesaccepting malformed hex leaves: a leaf with a non-hex digit, without a lowercase0xprefix (including0X…, whichHex.validateandBytes.fromHexalready rejected), or empty now throwsHex.InvalidHexValueErrorfor every output, asRlp.encodeTodoes, instead of producing invalid hex, encoding a bad single-byte leaf as0x00, or encoding a prefix-less leaf as empty. -
#720
e4fc3efThanks @jxom! - MadeAbiParametersandCbortree-shakeable by replacing their runtime namespaces with plain functions, so importing one of their errors or utilities no longer bundles packed encoding or the whole CBOR codec (AbiParameters.encodePacked.encode, an undocumented helper, is no longer exported). -
#727
13ae075Thanks @jxom! - Improved type-checking ofTypedData.encodeType,hashStruct,hashType,encodeData,encodeFieldandfindTypeDependenciesby about 700x (11,700 to 17 instantiations for a call): theirtypesparameter is a plain record of{ name, type }lists instead of abitype'sTypedData.
Patch Changes
-
#727
13ae075Thanks @jxom! - ImprovedAbiParameters.decodeperformance on data of up to 64 bytes: it copies words instead of viewing them, which V8 would first move to anArrayBufferof their own (oneuint256547 → 328 ns, oneaddress629 → 456 ns). -
#727
13ae075Thanks @jxom! - MadeAbiParameters.encodeandAbiFunction.encodeDatabuild their output as a string of hex digits instead of writing a byte buffer and hex-encoding it, skipped the integer-type regex and bound arithmetic foruint256andint256, lowercased addresses with the nativetoLowerCase, and hadAbiFunction.encodeData,AbiItem.getSelector,AbiItem.getSignatureandAbiItem.getSignatureHashtake their arguments without a rest array and closure, soAbiParameters.encoderuns about 4x faster,AbiFunction.encodeDataabout 4x faster with 4x less memory, andAbiItem.getSelectorabout 7x faster with 12x less memory, with the output and errors unchanged. -
#720
e4fc3efThanks @jxom! - Reduced the type instantiations of ABI encoding calls with inline values, such asAbiParameters.encodePacked(about 120×),AbiFunction.encodeResult(about 50×), andAbiParameters.encode,AbiFunction.encodeData,AbiError.encode,AbiConstructor.encodeandAbiEvent.encode(about 5×). -
#720
e4fc3efThanks @jxom! - DeclaredAbiError.solidityErrorandAbiError.solidityPanicas literals, so decoding or encoding an error no longer bundles the human-readable ABI parser. -
#727
13ae075Thanks @jxom! - Reduced the type instantiations ofAbiItem.fromAbi,AbiFunction.fromAbi,AbiEvent.fromAbiandAbiError.fromAbi(about 2.2×):fromAbi.Optionsdeclarespreparein each of its branches instead of intersecting it with them. -
#727
13ae075Thanks @jxom! - Reduced the type instantiations ofAbiFunction.encodeDatacalls: a function without inputs is recognized without resolving its parameter types (72 → 43 for a call without arguments). -
#727
13ae075Thanks @jxom! - MadeAbiItem.fromAbi(and thefromAbiofAbiFunction,AbiEvent,AbiError) find a uniquely named item without collecting matches into an array, which cuts the memory a lookup allocates by about 4x. -
#727
13ae075Thanks @jxom! - Removed the top-level side effects ofErrors.BaseError(its static initialization block), so bundles no longer keepBaseErrorand a module's unused error classes whenever they import anything from that module.Errors.BaseError.defaultStaticOptionsis now a getter. -
#727
13ae075Thanks @jxom! - MadeBytes.fromNumberwrite non-negative values up to 2^53, and negative signed values of up to 6 bytes, without BigInt arithmetic (about 3-4x faster for non-negative values and 3x faster for negative ones), and larger values 32 bits per BigInt operation (about 3.5x faster for 200-bit values); the output and errors are unchanged. -
#720
e4fc3efThanks @jxom! - FixedBytes.fromNumbertaking quadratic time for values or sizes above 64 bytes. -
#720
e4fc3efThanks @jxom! - FixedCbor.decodethrowing aRangeErrorfor a truncated 32-bit or 64-bit float instead ofCursor.PositionOutOfBoundsError. -
#727
13ae075Thanks @jxom! - Reduced the type instantiations ofSignatureandSignature.toRpc's input, of theas-dependent return types (Hash,Secp256k1,P256,Ed25519,Bls,Rlpand others), and ofRlp.fromHexandRlp.fromBytesoptions, without changing the resolved types. -
#727
13ae075Thanks @jxom! - Gavedistits ownpackage.json(typeandsideEffectsonly), so Node no longer parses ox's wholeexportsmap for every module it loads, which makes importing ox in Node about twice as fast (ox260 → 125 ms,ox/Hex11 → 6.5 ms). -
#727
13ae075Thanks @jxom! - MadeEns.normalizereturn names already in ENSIP-15 normal form (lowercase ASCII labels) without running the normalizer, which is about 60x faster for them; other names are normalized as before. -
#727
13ae075Thanks @jxom! - Wrote the ABI parameters behindSignatureErc6492.wrap/unwrap,Executebatch-of-batches encoding and decoding, andCalls.encode/decode/getAbiParametersout as JSON, so using them no longer bundles the human-readable ABI parser. -
#727
13ae075Thanks @jxom! - ImprovedSignatureErc6492.validateperformance: it checks the magic suffix directly instead of catching the errorassertthrows, so an invalid signature returnsfalseabout 100× faster and the function no longer bundles the error classes. -
#720
e4fc3efThanks @jxom! - FixedExecuteinox/erc7821importing the rootoxbarrel, which made importingox/erc7821load every ox module. -
#727
13ae075Thanks @jxom! - WroteSignatureErc8010.suffixParametersout as JSON ABI parameters instead of parsing a human-readable signature at import, so importing anything fromox/erc8010no longer runs or bundles the ABI parser. -
#727
13ae075Thanks @jxom! - ImprovedHex.padLeft,Hex.padRightand sized hex encoding (Hex.fromBytes,Hex.fromString,Hex.fromNumberwithsize) performance: padding up to 32 bytes slices a li...
ox@0.15.0
Minor Changes
-
#726
e238adbThanks @jxom! -Bytes.fromHex(and soRlp.fromHex,Rlp.toHexand every function that reads hex through it) now throws for a value that does not start with0x, including an uppercase0Xprefix, as ox 1.x does, instead of reading its first two characters as the prefix. For example,Rlp.fromHex('abcd')returned0x81cd, andRlp.fromHex('0XAB')returned0x81ab. -
#722
538df0dThanks @jxom! - Breaking: RemovedAbiParameters.encodePacked.encode, a runtime namespace member that keptencodePacked(withAddress.assertand keccak) in every bundle importingAbiParameters.AbiParameters.format, for example, drops from 5.9 kB to about 1.3 kB gzipped.- AbiParameters.encodePacked.encode('uint8', 1) + AbiParameters.encodePacked(['uint8'], [1])
-
#722
538df0dThanks @jxom! - Improved type-checking ofAbiParameters.encodePackedby about 8x (106,000 to 13,000 instantiations for a call) by constrainingtypestoreadonly unknown[]instead of a union that includesPackedAbiType[]. Values are still typed from the types, buttypesno longer autocompletes. -
#722
538df0dThanks @jxom! - FixedHex.toBigInt,Hex.toNumber,Bytes.toBigIntandBytes.toNumberthrowing aSyntaxError(or aNaNrange error) for empty input; empty hex and bytes now read as zero. -
#722
538df0dThanks @jxom! - Improved type-checking ofTypedData.encodeType,hashStruct,hashType,encodeData,encodeFieldandfindTypeDependenciesby about 700x (11,700 to 17 instantiations for a call): theirtypesparameter is a plain record of{ name, type }lists instead of abitype'sTypedData. -
#722
538df0dThanks @jxom! - Breaking (ox/erc4337):UserOperation.toRpcdropped an EntryPoint 0.8authorization; it now writes it aseip7702Auth, the field bundlers read (ERC-7769), andUserOperation.fromRpcreads it back.UserOperation.RpcV08haseip7702Authin place ofauthorization.const rpc: UserOperation.RpcV08 = { // ... - authorization: { address, chainId: '0x1', nonce: '0x0', r, s, yParity: '0x0' }, + eip7702Auth: { address, chainId: '0x1', nonce: '0x0', r, s, yParity: '0x0' }, } -
#722
538df0dThanks @jxom! - Breaking:Value.from(andfromEther,fromGwei) now throwsValue.InvalidDecimalNumberErrorfor input without digits ("",".","-","-."), which returned0nor threw aSyntaxErrorbefore, andValue.InvalidDecimalsErrorfor negative or non-integerdecimals. A negative value without integer digits, such as"-.0", now parses instead of throwing aSyntaxError.
Patch Changes
-
#726
e238adbThanks @jxom! - MadeAbiParameters.decode(and the ABI decoders built on it) faster for short data: the decoder copies words out of data of up to 64 bytes instead of taking views of it, which made V8 move the data to anArrayBufferfirst, andBytes.toBigIntreads a fresh word without one.AbiParameters.decodeof one word runs about 1.6x faster; the output and errors are unchanged. -
#726
e238adbThanks @jxom! - MadeAbiFunction.encodeDatafaster and leaner: it writes the parameters' encoding straight after the selector instead of slicing and copying a0x-prefixed encoding,AbiItem.getSelectorandAbiItem.getSignatureHashno longer allocate a closure and an arguments array per call, and the ABI encoder sizes its list of parameters up front.encodeDataof an(address, uint256)call goes from about 300 to 170 ns and from 1.1 kB to 360 B allocated. -
#726
e238adbThanks @jxom! - MadeAbiParameters.encodebuild its output as one string of hex digits, instead of creating, slicing and concatenating a0xstring per word.AbiParameters.encoderuns about 4x faster with a quarter of the memory, andAbiFunction.encodeDataabout 3x faster; the output and errors are unchanged. -
#722
538df0dThanks @jxom! - WroteAbiError.solidityErrorandAbiError.solidityPanicout as literals with the signature hashesAbiError.fromadds, instead of callingAbiError.fromat module load, so using either no longer bundles the ABI parser and keccak (9.7 kB to 155 B gzipped). -
#726
e238adbThanks @jxom! - MadeAbiItem.fromAbi(andAbiFunction.fromAbi,AbiError.fromAbi,AbiEvent.fromAbi) find a unique match without collecting the matches into an array first. -
#726
e238adbThanks @jxom! - Reduced the type instantiations of the ABI modules' generic signatures. Wide parameters (readonly AbiParameter[]) now resolve toreadonly unknown[]without mapping every ABI type, andAbiItem.fromAbi.Optionsputspreparein each of its branches instead of intersecting it with them.Parameters<typeof AbiFunction.encodeData>drops from about 10,800 instantiations to 500,AbiParameters.encodefrom 10,600 to 300, andAbiFunction.fromAbiandAbiItem.fromAbifrom about 14,600 to 2,100. The types are unchanged. -
#726
e238adbThanks @jxom! - MadeAddress.checksumbuild the checksummed address from character codes instead of splitting, uppercasing and joining an array of characters. -
#722
538df0dThanks @jxom! - MadeAddress.isEqualcheck its inputs without bundlingAddress.checksumand keccak, which makes its bundle about 4x smaller. -
#726
e238adbThanks @jxom! - MadeErrors.BaseErrorset its fields in its constructor instead of declaring them as class fields, which the ES2021 build compiled to anObject.definePropertycall each. Bundles that include an error shrink by about 30 bytes (gzip); errors keep the same properties in the same order. -
#722
538df0dThanks @jxom! - Removed the top-level side effects ofErrors.BaseError(its static initialization block), so bundles no longer keepBaseErrorand a module's unused error classes whenever they import anything from that module.Errors.BaseError.defaultStaticOptionsis now a getter. -
#722
538df0dThanks @jxom! - FixedBase58encoding of empty input and all-zero bytes, andBase58.toHexreturning odd-length hex for values whose first byte is below0x10. -
#726
e238adbThanks @jxom! - MadeBase64.fromBytesencode withUint8Array.prototype.toBase64where the runtime has it (about 5x faster on Node 26), andBase64.toBytesdecode withoutTextEncoderand a regular expression (about 6x faster). Valid input decodes as before. A character outside the Base64 alphabets now decodes as zero bits wherever it appears; before, one at the end of a group of four zeroed the group's three bytes, and a non-ASCII character counted once per UTF-8 byte. -
#726
e238adbThanks @jxom! - MadeBytes.fromNumberwrite its bytes directly instead of encoding the number as hex withHex.fromNumberand decoding that: an unsigned safe integer that fits itssizeis written without BigInt arithmetic (about 2.5x faster with half the memory), and bundles that only encode numbers to bytes are about 30% smaller. A fractionalsizenow throws for numbers as it already did for bigints. `He...
ox@1.8.21
Patch Changes
- #716
dca97e0Thanks @brendanjryan! - FixedSecp256k1.verifyto reject signatures with a highsvalue when verifying against anaddress, matching thepublicKeypath and fixingSignatureEnvelope.verifyinox/tempo.